Posted By

m-pokrovskii on 02/17/10


Tagged

wordpress querypost


Versions (?)

Wordpress. Exclude children category


 / Published in: PHP
 

URL: pokrovskii.com

  1. <?php
  2. #exclude children category
  3. $get_childs = get_categories('child_of='.$cat);
  4. $q_cat = "cat=$cat";
  5. foreach ($get_childs as $cat_child) {
  6. $q_cat .= ",-$cat_child->cat_ID";
  7. }
  8. $query = new WP_Query($q_cat);
  9. ?>

Report this snippet  

You need to login to post a comment.