Hide address, … from non-logged in users

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

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

Open Support Ticket
  • Author
    Posts
  • #528699

    Andreas
    Expired Member
    Post count: 43

    Hi,

    I want to hide the address, telephone number and email address from non-logged in users.
    I found the following information on your homepage:

    Hide the default phone number from logged out users
    Sometimes you may want to hide some listing information from users that are not logged in. Here is an example of how you can do that with the default phone number.

    [css]
    .geodir_contact {display: none}
    .logged-in .geodir_contact {display: initial}
    [/css]

    But unfortunately that doesn’t work.

    Best regards
    Andreas

    #528705

    Alex Rollin
    Moderator
    Post count: 27815

    WordPress uses body classes for logged in and logged out users. You can use those to hide information with CSS.

    If you want to do keep it from being output at all then you will need custom code or a 3rd party plugin.

    #529256

    Andreas
    Expired Member
    Post count: 43

    Hi Alex,
    how can I use the body classes?

    I want to hide the address for visitors who are not logged in. The address should only be read when the visitor is logged on.
    I found this code on your homepage https://wpgeodirectory.com/support/topic/hiding-conatct-details-from-detail-page/ Post #444899 but unfortunately it doesn’t work for me. Where is my mistake?

    [css]
    .geodir_contact {display: none}
    .logged-in .geodir_contact {display: initial}
    [/css]

    Best regards
    Andreas

    #529410

    Alex Rollin
    Moderator
    Post count: 27815

    Please share an example page so we can take a look.
    The CSS in the link is for V1.

    #529662

    Andreas
    Expired Member
    Post count: 43
    This reply has been marked as private.
    #529715

    Alex Rollin
    Moderator
    Post count: 27815

    You can try this and change the selector to meet your needs to target one or another address displays.

    [css]
    .geodir_post_meta.geodir-field-address {
    display: none;
    }
    .logged-in .geodir_post_meta.geodir-field-address {
    display: none;
    }
    [/css]

    If we need to check the settings include WP Admin

    BTW, again, you are better off using a 3rd party plugin if you really want to hide this information. CSS will not keep the information from being available in the page.

    #529828

    Andreas
    Expired Member
    Post count: 43

    Hi Alex,

    thanks, you have any idea what plugIn I can use to hide the information?
    What should I look for. What are the keywords?

    Best regards
    Andreas

    #529875

    Alex Rollin
    Moderator
    Post count: 27815

    We always recommend widget logic, and it may work for your case.

    https://wpgeodirectory.com/docs-v2/faq/common-examples/#logic

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