Specific categories statement
-
I am unable to add the ratings shortcode on specific pages/posts content area because of where I am loading the ratings so I choose to enter the code in one of the theme templates.
Per your instructions, this works and does what it’s supposed to.
<?php if(function_exists('the_ratings')) { the_ratings(); } ?>
However, I want to have it only show for specific categories so I use…
<?php if ( is_single() && in_category( array( 3, 5, 14 ) ) ) : ?> <?php if(function_exists('the_ratings')) { the_ratings(); } ?> <?php endif; ?>
That code works and loads for the specific categories. However, it seems that I should write the if statements differently from what I’ve read about php if statements online.
Is there a better way to write this?
Thank you very much.
- The topic ‘Specific categories statement’ is closed to new replies.