Address Format on Details Page

This topic contains 7 replies, has 4 voices, and was last updated by  Lance Sampson 7 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #361187

    Lance Sampson
    Buyer
    Post count: 108

    Hi

    I was given the attached code to format the address on the search page. How can I modify it to ALSO change the address to the same on the details page?

    Thanks

    #361238

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Lance,

    Please see this post for upto date code, it will replace the other code u have:

    https://wpgeodirectory.com/support/topic/change-order-address/#post-279068

    Stiofan

    #361253

    Lance Sampson
    Buyer
    Post count: 108

    Hi Stiofan

    I tried this code and it doesn’t seem to work. First of all, can I put it into the snippets plugin and I am trying to change the address at the TOP of the details page on the supreme template. NOT the right sidebar. Is this the correct code for that?

    Thanks for your help!

    #361264

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    there is no address at the top of the detail page of supreme, just City, Region and Country.

    What are you trying to change?

    Thanks

    #361638

    Lance Sampson
    Buyer
    Post count: 108

    Paolo, I want the format below:

    address
    city, region zip.

    thanks for your help

    #361639

    Paolo
    Site Admin
    Post count: 31206

    I think it’s easy to do, but you’ll probably have to apply the code after every update, I doubt there is a hook for it.

    The developers will let you know asap.

    Thanks

    #361674

    Giri
    Expired Member
    Post count: 3155

    Hi Lance,

    Please try this code in code snippets.

    
    
    add_filter('sd_details_output_address', 'modify_sd_details_output_address');
    function modify_sd_details_output_address() {
        global $post;
        $sd_address = '<div class="sd-address">';
        if (isset($post->post_address) && $post->post_address) {
            $sd_address .= apply_filters('sd_detail_address', $post->post_address, $post);
        }
        if (isset($post->post_city) && $post->post_city) {
            $sd_address .= '<br/>' . 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_zip) && $post->post_zip) {
            $sd_address .= ', ' . apply_filters('sd_detail_zip', $post->post_zip, $post);
        }
        $sd_address .= '</div>';
    
        return $sd_address;
    }
    #361793

    Lance Sampson
    Buyer
    Post count: 108

    That works great!

    Giri, thanks for all your help!

    This forum delivers great support.

    Best Regards

Viewing 8 posts - 1 through 8 (of 8 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket