Show complete address
This topic contains 24 replies, has 4 voices, and was last updated by Giri 7 years, 8 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
June 5, 2017 at 5:12 am #381643
Hello!
Is it possible to show the complete address of the CPT, right under the title of the listing, instead of only showing the country, and region?
I´d like it to show street, and neighborhood too.
Thank you!
June 5, 2017 at 6:05 am #381649Hi Tania,
Please try using the custom CSS code below and see if it works. Insert into the “Code Snippets” plugin.
function gd_custom_sd_details_output_address( $address = '' ) { global $post; if ( $address && !empty( $post->post_address ) ) { $sd_address = '<span class="sd-address-only">' . stripslashes( $post->post_address ) . ', </span>'; $address = str_replace( '<div class="sd-address">', '<div class="sd-address">' . $sd_address , $address ); } return $address; } add_filter( 'sd_details_output_address', 'gd_custom_sd_details_output_address', 10, 2 );
June 5, 2017 at 7:26 pm #381806Hi Kor!
It does show the street, but it doesn´t show the neighborhood. Can we add something else to it?
It´s also creating a huge space between the address and the Description Fields. I´m attaching an image to show you.
Can we fix that?
Thank you!
June 6, 2017 at 7:36 am #381857Hi Tania,
With the help from a developer, I’m able to fix the issue and added the neighbourhood to the address section. Could you check and see if it’s what you’re looking for? Below is the code for our reference.
function gd_custom_sd_details_output_address( $address = '' ) { global $post; if ( $address && !empty( $post->post_address ) ) { $sd_address = '<span class="sd-address-only">' . stripslashes( $post->post_address ) . ', </span>'; $address = str_replace( '<div class="sd-address">', '<div class="sd-address">' . $sd_address , $address ); } return $address; } add_filter( 'sd_details_output_address', 'gd_custom_sd_details_output_address', 10, 2 ); function gd_custom_sd_details_output_social_neighbourhood( $social = '' ) { global $post; if ( geodir_is_page( 'detail' ) && !empty( $post ) && !empty( $post->post_neighbourhood ) && !empty( $post->country_slug ) && defined( 'GEODIRLOCATION_VERSION' ) ) { if ( get_option( 'location_neighbourhoods' ) && $neighbourhood_info = geodir_location_get_neighbourhood_by_id( $post->post_neighbourhood, true, $post->post_location_id ) ) { $social = '<div class="sd-neighbourhood" style="clear:both;"><span class="geodir-i-neighbourhood" style=""><i class="fa fa-location-arrow"></i> ' . __( 'Neighbourhood:', 'geodirectory' ) . ' </span> ' . $neighbourhood_info->hood_name . '</div>' . $social; } } return $social; } add_filter( 'sd_details_output_social', 'gd_custom_sd_details_output_social_neighbourhood', 10, 1 );
June 9, 2017 at 12:42 am #382412Thank you Kor!
Almost:) The neighborhood is showing now, but below the rating, and not with the address.
The right way would be: Street, Neighborhood, City, Region, Country.
I´m attaching an image to show you how it should look (red frame is how it looks now, green how it should). The address can go in one single line, or two lines, like the example I´m sending.
The huge space is now corrected!
Thank you!
June 9, 2017 at 5:33 am #382423Hi Tania,
Try using this custom CSS and see if it’s what you’re looking for.
.sd-address font { display:block!important; }
June 9, 2017 at 9:43 pm #382559Hi Kor!
It didn´t do anything to the address bar.
Let me attach the image again. The text in the yellow circle is the neighborhood, to be specific.
Thank you!!!!
June 13, 2017 at 1:18 pm #382972Hi Tania,
Try modifying kor code like this.
Replace this line
add_filter( 'sd_details_output_social', 'gd_custom_sd_details_output_social_neighbourhood', 10, 1 );
with
add_filter( 'sd_details_output_address', 'gd_custom_sd_details_output_social_neighbourhood', 11, 1 );
June 14, 2017 at 7:35 pm #383285Hi Giri,
It´s now showing the neighborhood on top of the address like this:
Line 1: Neighborhood
Line 2: Street, City, Region, Country.
I´m attaching a screen of how it looks with the modification you sent.The way it should be is:
Line 1: Street, Neighborhood,
Line 2: City, Region, Country.Thank you!!
Tania
June 15, 2017 at 1:03 pm #383375Hi Tania,
remove existing code and replace with this one.
function gd_custom_sd_details_output_address( $address = '' ) { global $post; $sd_address = '<div class="sd-address">'; if (isset($post->post_city) && $post->post_city) { $sd_address .= apply_filters('sd_detail_city_name', $post->post_city, $post); } $sd_address .= '</div>'; $sd_address .= '<div class="sd-address">'; if ( geodir_is_page( 'detail' ) && !empty( $post ) && !empty( $post->post_neighbourhood ) && !empty( $post->country_slug ) && defined( 'GEODIRLOCATION_VERSION' ) ) { if ( get_option( 'location_neighbourhoods' ) && $neighbourhood_info = geodir_location_get_neighbourhood_by_id( $post->post_neighbourhood, true, $post->post_location_id ) ) { $sd_address .= '<div class="sd-neighbourhood" style="clear:both;"><span class="geodir-i-neighbourhood" style=""><i class="fa fa-location-arrow"></i> ' . __( 'Neighbourhood:', 'geodirectory' ) . ' </span> ' . $neighbourhood_info->hood_name . '</div>' . $social; } } $sd_address .= '</div>'; $sd_address .= '<div class="sd-address">'; if (isset($post->post_region) && $post->post_region) { $sd_address .= ', ' . apply_filters('sd_detail_region_name', $post->post_region, $post); } if (isset($post->post_country) && $post->post_country) { $sd_address .= ', ' . apply_filters('sd_detail_country_name', __($post->post_country, 'geodirectory'), $post); } $sd_address .= '</div>'; return $sd_address; } add_filter( 'sd_details_output_address', 'gd_custom_sd_details_output_address', 10, 2 );
June 16, 2017 at 9:19 pm #383652Hi Giri!!!
I changed the code, but now it doesn´t show the streer, and now it´s showing this order, all in the same line:
City, neighborhood, region, country
Find an image attached
Thanks for your help!!
June 19, 2017 at 9:23 am #383803Hi Tania,
Please try this code.
function gd_custom_sd_details_output_address( $address = '' ) { global $post; $sd_address = '<div class="sd-address">'; if (isset($post->post_address) && $post->post_address) { $sd_address .= apply_filters('sd_detail_post_add', $post->post_address, $post); } $sd_address .= '</div>'; $sd_address .= '<div class="sd-address">'; if ( geodir_is_page( 'detail' ) && !empty( $post ) && !empty( $post->post_neighbourhood ) && defined( 'GEODIRLOCATION_VERSION' ) ) { if ( get_option( 'location_neighbourhoods' ) && $neighbourhood_info = geodir_location_get_neighbourhood_by_id( $post->post_neighbourhood, true, $post->post_location_id ) ) { $sd_address .= '<div class="sd-neighbourhood" style="clear:both;"><span class="geodir-i-neighbourhood" style=""><i class="fa fa-location-arrow"></i> ' . __( 'Neighbourhood:', 'geodirectory' ) . ' </span> ' . $neighbourhood_info->hood_name . '</div>' . $social; } } $sd_address .= '</div>'; $sd_address .= '<div class="sd-address">'; if (isset($post->post_city) && $post->post_city) { $sd_address .= apply_filters('sd_detail_city_name', $post->post_city, $post); } if (isset($post->post_region) && $post->post_region) { $sd_address .= ', ' . apply_filters('sd_detail_region_name', $post->post_region, $post); } if (isset($post->post_country) && $post->post_country) { $sd_address .= ', ' . apply_filters('sd_detail_country_name', __($post->post_country, 'geodirectory'), $post); } $sd_address .= '</div>'; return $sd_address; } add_filter( 'sd_details_output_address', 'gd_custom_sd_details_output_address', 10, 2 );
June 20, 2017 at 11:02 pm #384123Perfect!!!!! Thank you!!
June 21, 2017 at 12:23 am #384127Sorry, thought it was done, but some listings are, and some are showing a huge space between the address and the rest of the listing, or pulling some info from line 2, which are the reviews and comments.
I´m attaching 2 images
On mobile it looks exactly like it should. I´m attaching an image too
Thank you!!
June 21, 2017 at 12:27 am #384130This is how it looks on mobile, which is perfect.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket