php - How do I show all posts but exclude a specific category on wordpress? -
I have this code, which still cares about all the posts without any class.
& lt ;? Start Php / * Loop /? & Gt; & Lt ;? Php global $ query_string; Query_posts ($ query_string 'and _sticky_posts = 1'); ? & Gt; & Lt ;? Php while (is_pos ()): the_post (); ? & Gt; & Lt ;? Php get_template_part ('content', get_post_format ()); ? & Gt; & Lt ;? Php timeline; // End of loop? & Gt; & Lt ;? Php wp_reset_query (); // Reset query? & Gt; How do I do the same thing, except for the posts with the category 'blog'?
You can use the thing below: -
$ Query = new WP_Query ('cat = -12, -34, -56'); OR
$ query = new WP_Query (array ('category__not_in' = & gt; array (2, 6));
Comments
Post a Comment