Title: controlling posts without a plugin, using Kubrick
Last modified: August 19, 2016

---

# controlling posts without a plugin, using Kubrick

 *  [sergibosch](https://wordpress.org/support/users/sergibosch/)
 * (@sergibosch)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/controlling-posts-without-a-plugin-using-kubrick/)
 * wp community,
 * I have tried super hard to resolve this question by reading up on pages; the 
   loop; templates; themes; conditional tags, and template hierarchy.
 * i’ve seen variations of this question a few times in these forums. the answer
   is usually “read this page (such as templates page or theme page)”. that’s often
   the last comment in the thread. my gut tells me it’s because they were intimidated;
   not that they figured it out by reading the suggested page.
 * here is what i’m trying to accomplish: i have a series of posts that are category-
   3, or “news”. i don’t want them to appear on the blog page; only on the news 
   page. i used the following code to omit them from the blog page:
 *     ```
       function exclude_category($query) {
       if ( $query->is_home ) {
       $query->set('cat', '-3');
       }
       return $query;
       }
       ```
   
 * what i can’t accomplish: how do i get the posts w/ category-3 to appear on a 
   page titled “news”?
 * i’m using the Kubrick theme.
 * thank you!!!!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/controlling-posts-without-a-plugin-using-kubrick/#post-1354224)
 * read this first or later:
    pages: [http://codex.wordpress.org/Pages](http://codex.wordpress.org/Pages)
   [http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates](http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates)
 * make a copy of index.php and call it ‘news-template.php’ for instance.
    edit 
   it and put this code into the top:
 *     ```
       <?php
       /*
       Template Name: News Template
       */
       ?>
       ```
   
 * query_posts:
    [http://codex.wordpress.org/Template_Tags/query_posts](http://codex.wordpress.org/Template_Tags/query_posts)
   [http://codex.wordpress.org/Template_Tags/query_posts#Category_Parameters](http://codex.wordpress.org/Template_Tags/query_posts#Category_Parameters)
 * go down to after:
 *     ```
       <div id="content" class="narrowcolumn" role="main">
       ```
   
 * add the line to news-template.php:
 *     ```
       <?php query_posts('&cat=3'); ?>
       ```
   
 * in ‘admin’ – ‘pages’ – ‘add new’: make a new page with the title ‘news’
 * on the right under ‘attributes’ ‘template’ click the drop down menu and select‘
   news template’.
 * save and publish the page.
 * back into view site: if you have the ‘pages’ widget in the sidebar, you should
   see the page ‘news’.
    click it, and you should see the posts with category-3.
 * you will see that after a while even the codex begins to make sanse to you 😉
 *  Thread Starter [sergibosch](https://wordpress.org/support/users/sergibosch/)
 * (@sergibosch)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/controlling-posts-without-a-plugin-using-kubrick/#post-1354348)
 * alchymyth
 * thanks much! have experience with all the above except for the “magical snippet”:
   <`?php query_posts('&cat=3'); ?>`
 * i really appreciate your time to post this response. gonna tackle your suggestion.
 *  Thread Starter [sergibosch](https://wordpress.org/support/users/sergibosch/)
 * (@sergibosch)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/controlling-posts-without-a-plugin-using-kubrick/#post-1354397)
 * hi, alchymth,
 * i wanted to follow up. maybe this post will be helpful to others.
 * once i implemented the solution you suggested for targeting posts of category
   3, the function i had been using stopped working.
 * final solution:
    use `<?php query_posts('&cat=3'); ?>` to have only category-
   3 post appear.
 * and use `<?php
    if (is_home()) { query_posts(“cat=-3”); } ?> ` to omit category-
   3 posts from the blog page.
 * helpful link: [http://codex.wordpress.org/Template_Tags/query_posts#Post_.26_Page_Parameters](http://codex.wordpress.org/Template_Tags/query_posts#Post_.26_Page_Parameters)
 * thanks again for your help!
 *  Thread Starter [sergibosch](https://wordpress.org/support/users/sergibosch/)
 * (@sergibosch)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/controlling-posts-without-a-plugin-using-kubrick/#post-1354474)
 * another follow up:
 * you have to be careful with putting running `query_posts` as i did, in that it
   will ruin your pagination, such as links to “older entries” and “newer entries”.
   you can read about such dangers here: [http://codex.wordpress.org/Template_Tags/query_posts](http://codex.wordpress.org/Template_Tags/query_posts)
 * here is the final snippet i used to prevent posts of a certain category from 
   appearing on the blog page:
 *     ```
       global $wp_query;
       query_posts(
       	array_merge(
       		array('cat' => -3),
       		$wp_query->query
       	)
       );
       ```
   

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘controlling posts without a plugin, using Kubrick’ is closed to new replies.

## Tags

 * [categories](https://wordpress.org/support/topic-tag/categories/)
 * [category id](https://wordpress.org/support/topic-tag/category-id/)
 * [omit](https://wordpress.org/support/topic-tag/omit/)
 * [page](https://wordpress.org/support/topic-tag/page/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [sergibosch](https://wordpress.org/support/users/sergibosch/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/controlling-posts-without-a-plugin-using-kubrick/#post-1354474)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
