Hiding the listing address

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

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

Open Support Ticket
  • Author
    Posts
  • #460720

    justmark
    Full Member
    Post count: 375

    I am trying to achieve the same result as in V1 where I am hiding the street address on all my listings using this css code:

    add_filter(‘geodir_show_post_address’, ‘geodir_change_address_order’ , 100 , 2) ;
    function geodir_change_address_order($html , $vars)
    {
    global $post, $preview, $wpdb;
    $field_icon=”;
    if (strpos($field_icon,’http’) !== false) {$field_icon_af = ”;}
    elseif($field_icon==”){$field_icon_af = ‘<i class=”fa fa-home”></i>’;}
    else{$field_icon_af = $field_icon; $field_icon=”;}

    if(!$preview)
    {
    $html = ‘

    ‘;
    $html .= ‘<span class=”geodir-i-location” style=”‘.$field_icon.'”>’.$field_icon_af;
    $html .= ‘ Location: ‘;
    $html .= ‘</span>’;
    //print_r($_POST);

    if($post->post_city){ $html .= ‘<span itemprop=”addressLocality”>’.$post->post_city.'</span>
    ‘;}

    if($post->post_country){ $html .= ‘<span itemprop=”addressCountry”>’.$post->post_country.'</span>
    ‘;}
    $html .= ‘

    ‘;
    }
    return $html ;
    }

    Not being a CSS expert, I was hoping I could add some CSS code to the GD Details Page Template (which is set up as default currently) or adding css code to the address Standard Field.

    Bottom line is that my users are less interested in the exact address of the listing, more the city and country.

    #460741

    Greg Barr
    Full Member
    Post count: 182

    I played with that myself. It’s easy to make a given address field just “not appear” with this CSS targeting the “itemprop” for each field of the address.

    
    
    span[itemprop="streetAddress"]  {
       display:none;
    }

    The problem is there’s a <br> tag after the span that doesn’t go away, so the space that line of the address occupies persists.

    #460742

    Greg Barr
    Full Member
    Post count: 182

    Hope that’s helpful. Not as fancy/complete a solution as that fancy stuff you did there. That’s way over my head, so I’m kinda sure I shouldn’t be offering up my little trick, lol.

    I just realized you can’t expand/zoom embedded images so here’s one that better shows the CSS and affect.

    #460797

    Alex Rollin
    Moderator
    Post count: 27815

    We are working on a tool for modifying the address display for a future version.

    In the meantime you can customize it with this snippet here:

    https://wpgeodirectory.com/support/topic/change-address-format-2/#post-453834

Viewing 4 posts - 1 through 4 (of 4 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