Title: Specific categories statement
Last modified: January 3, 2020

---

# Specific categories statement

 *  [TRY01](https://wordpress.org/support/users/try01/)
 * (@try01)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/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.

 * ![](https://ps.w.org/wp-postratings/assets/icon.svg?rev=978014)
 * [WP-PostRatings](https://wordpress.org/plugins/wp-postratings/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-postratings/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-postratings/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-postratings/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-postratings/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-postratings/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [TRY01](https://wordpress.org/support/users/try01/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/specific-categories-statement/)
 * Status: not resolved