Treehouse: Grow your CSS skills. Land your dream job.

Can’t get this Conditional Statement to work in WordPress

  • # January 6, 2013 at 7:39 pm

    Can anyone point me in the right direction with this? I’m trying to get the following statement to work in my wordpress theme:

    [PasteBin Link]( “PasteBin Link”)

    I need to have that H3 title show only when the post has a tag of “awesome”. It’s not working. Nothing is showing at all.


    # January 8, 2013 at 10:59 pm

    < ?php
    if( has_term( ‘awesome’, ‘product_tag’,$post->ID ) ) { ?>

    < ?php } ?>
    Is what I’m trying to do. Anyone see why this wouldn’t work?

    # January 8, 2013 at 11:33 pm

    @Preeminent if you are inside the loop then leave out the $post->ID.

    # January 9, 2013 at 10:02 pm

    I wish man. No go. Thanks for your input though! It’s weird. Seems simple enough for it to work.

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

You must be logged in to reply to this topic.