[closed] PHP if statements (2 posts)

  1. damian.smith
    Posted 3 years ago #

    Hey guys,

    I have posted this into the woocommerce section but not getting any responses.
    Basically I have the below code, which doesn't seem to be working.

    It is basically trying to find out the current product category and then depending on what it is display "this"

    Is there something wrong with my code?

    $terms = get_the_terms( $post->ID, 'product_cat' );
    $term = current($terms);
    if ($term == "safety-range") {
    echo "<h1>hello</h1>";
  2. Mark Ratledge
    Forum Moderator
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.