Posted By

LuckyShot on 12/07/09


Tagged

post wordpress category


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

maxvee8


Wordpress - Check if posts belongs to a category


 / Published in: PHP
 

URL: http://codex.wordpress.org/Function_Reference/in_category

  1. <?php
  2.  
  3.  
  4. if ( in_category('News') ) {
  5. // belongs to cat
  6. }
  7.  
  8. // or array
  9. if ( in_category(array('News', 'Tools')) ) {
  10. // belongs to one or more of the categories
  11. }

Report this snippet  

You need to login to post a comment.