Listing Details Address

This topic contains 2 replies, has 2 voices, and was last updated by  Alex Rollin 6 years, 9 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #435818

    Drew Tumlinson
    Free User
    Post count: 19

    Hello, I have customized the address format in the sidebar on the listing details pages using the code below

    
    
    function cutsom_gd_address_output($html, $variables_array) {
        if (geodir_is_page('detail')) {
            $html = str_replace('<br>', '', $html);
            $html = str_replace('<span itemprop="streetAddress">', '<span class="businessName"  style="display: block; clear: both;">' . get_the_title() . '</span><span itemprop="streetAddress">', $html);
            $html = str_replace('<span itemprop="streetAddress">', '<span class="boxAddress" itemprop="streetAddress" style="clear: both; display: block;">', $html);
    		$html = str_replace('<span itemprop="addressRegion">', '<span class="boxAddress" itemprop="addressRegion" style="clear: both; display: inline-block">&nbsp;', $html);
            $html = str_replace('<span itemprop="addressCountry">', '<span class="boxAddress" itemprop="addressCountry" style="display: none">', $html);
            $html = str_replace('<span itemprop="postalCode">', '<span class="boxAddress" itemprop="postalCode">&nbsp;', $html);
        }
        return $html;
    }
    add_filter('geodir_show_post_address', 'cutsom_gd_address_output', 10, 2);

    It is altered from the code provided here.

    My problem is that the code is not pulling the city, though the city does display in the details sidebar. I need to add the boxAddress class to the city as well.

    I see the above code isn’t pulling it individually (even though it displays on the frontend), therefore not allowing me to add the class, so how do I add that?

    You can view the listing here.

    #435825

    Drew Tumlinson
    Free User
    Post count: 19

    I ended up just using span[itemprop=”addressLocality”] to target the element. Just not as clean as I’d hoped, but that’s ok.

    #435828

    Alex Rollin
    Moderator
    Post count: 27815

    Glad you found a solution 🙂

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

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

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount