Advertisement
Guest User

Untitled

a guest
Mar 15th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. global $query_string;
  2.  
  3. $query_args = explode("&", $query_string);
  4. $search_query = array();
  5.  
  6. foreach($query_args as $key => $string) {
  7. $query_split = explode("=", $string);
  8. $search_query[$query_split[0]] = urldecode($query_split[1]);
  9. } // foreach
  10.  
  11. $all = get_posts(array('post_type'=> 'page', 'posts_per_page' => -1));
  12. $parents = array();
  13. foreach ($all as $single)
  14. {
  15. $kids = get_children($single->ID);
  16. if(isset($kids) && !empty($kids) && count($kids) >= 1)
  17. {
  18. $parents[] = $single->ID;
  19. }
  20. }
  21.  
  22. $search_query['post__in'] = $parents;
  23. $search = new WP_Query($search_query);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement