Posted By

elightbo on 03/24/10


Tagged

textmate wordpress customfield


Versions (?)

Exclude page from wp_list_pages using custom field


 / Published in: PHP
 

  1. global $post;
  2. $args=array(
  3. 'post_type' => 'page',
  4. 'meta_key' => 'show_list',
  5. 'meta_compare' => '=',
  6. 'meta_value' => 'false'
  7. );
  8. $pages = get_posts($args);
  9. if ($pages) {
  10. $pageids = array();
  11. foreach ($pages as $page) {
  12. $pageids[] = $page->ID;
  13. }
  14. }
  15. wp_list_pages('exclude=' . implode(",", $pageids) . '&title_li=');

Report this snippet  

You need to login to post a comment.