treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Can't get this Conditional Statement to work in Wordpress

  • 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

    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.

    Thanks!

  •     <?php
                  if( has_term( 'awesome', 'product_tag',$post->ID ) ) { ?>
                   <div id="featured-title">
                     <h3><?php echo get_post_meta($post->ID, 'deal-title', true); ?></h3>
                   </div><!--end featured-title-->
                <?php } ?>
    

    Is what I'm trying to do. Anyone see why this wouldn't work?

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

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