Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $query_string;
- $my_query_string = $query_string;
- $catnames = array('post-format-aside','post-format-link','post-format-gallery','post-format-status','post-format-quote','post-format-image');
- //using implode to generate the list of formats ids comma-separated
- $catnames[0] = "-".$catnames[0];
- $format_id_list_to_exclude = implode(",-",$catnames);
- $catnames[0] = substr('$catnames[0]', 1);
- $format_id_list = implode(",",$catnames);
- //query posts excluding posts that have formats:
- $myquery = new WP_Query ($my_query_string . "&cat=$format_id_list_to_exclude");
- if ($myquery->have_posts()) :
- while ($myquery->have_posts()) : $myquery->the_post();
- //display non-formated posts
- endwhile;
- endif;
- $myquery = new WP_Query ($my_query_string . "&cat=$format_id_list");
- if ($myquery->have_posts()) :
- while ($myquery->have_posts()) : $myquery->the_post();
- //display non-formated posts
- endwhile;
- endif;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement