Post author help

This topic contains 9 replies, has 3 voices, and was last updated by  Paolo 8 years, 4 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #63840

    Joy
    Buyer
    Post count: 1076

    Hello team, I am trying to hide a widget that shows on my page according to the author post. For example, if admin is the listing author, then I want to hide “x” sidebox widget. Can this be achieved? I thought I would ask for your help with this. Thank you.

    #63841

    Joy
    Buyer
    Post count: 1076

    If this can’t be done, does the tags on the places use the wp conditional tags? I am trying to display certain widgets on certain pages only. For example, IF a place is tagged as a beach in the place tags, THEN I want “x” widget to show up. If NOT, it should be hidden…help? Please?

    #63846

    Guust
    Moderator
    Post count: 29970

    Have a look at the “widget logic” plugin. That should do the trick I think.

    #63851

    Joy
    Buyer
    Post count: 1076

    I have and have been trying to get it to work. But it doesn’t. I’ve tried with the tags and the wp conditinal tags don’t seem to pickup on the gd tags.

    #63878

    Joy
    Buyer
    Post count: 1076

    Nothing I’ve tried is working, but I see there are other posts about using this plugin but the ones I’ve seen only pertain to the events or category. How do I use a condition to read the tags please? Thank you.

    #63913

    Paolo
    Site Admin
    Post count: 31206

    Have you tried the wp function has_terms() with widget logic?

    https://codex.wordpress.org/Function_Reference/has_term

    For a place category:

    if ( has_term ( 'categroy-name', 'gd_placecategory' ) )

    For a place tag:

    if ( has_term ( 'tag-name', 'gd_place_tags' ) )

    Obivously you’ll have to change the taxonomy for other CPT.

    Let us know,

    #63941

    Joy
    Buyer
    Post count: 1076

    I have but I don’t fully understand how it’s used. Would I put this into the widget logic conditionals?

    I would like “x” widget to show IF there is the “beach” tag attached to a listing. I don’t know how to achieve this and I’ve been working at it for hours. 🙁

    #63960

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    I just tested it here adding a text widget in the right sidebar down at the bottom, only if the listing has a tag skyscraper:

    Yes: http://wpgeo.directory/attractions/united-states/illinois/chicago/landmark/john-hancock-center/

    No: http://wpgeo.directory/attractions/united-states/illinois/chicago/landmark/crown-fountain/

    The logic is:

    has_term ( 'skyscraper', 'gd_place_tags' )

    Change skyscraper to beach and gd_place_tags to whatever CPT you are using, if it ins’t places.

    Let me know if this helped.

    Thanks

    #63969

    Joy
    Buyer
    Post count: 1076

    Ahhhh! Thank you so much. It worked. 🙂

    #63973

    Paolo
    Site Admin
    Post count: 31206

    You are welcome : 🙂

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

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

Open Support Ticket