Title: Remove sticky posts from &quot;posts page&quot;
Last modified: August 20, 2016

---

# Remove sticky posts from "posts page"

 *  [diagrammar](https://wordpress.org/support/users/diagrammar/)
 * (@diagrammar)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/remove-sticky-posts-from-posts-page/)
 * I want to remove sticky posts from my posts page.
    I’m using a child theme of
   twenty-eleven and the home page (called “Base”) uses the showcase template to
   display featured posts.
 * The post page (called “Ticker”) uses the sidebar template. I want to remove the
   featured posts from the top of this page (while retaining them on the showcase
   template of the home page)
 * The site:
    [http://www.jrsfantasticmachines.com/](http://www.jrsfantasticmachines.com/)
 * Thanks!

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

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/remove-sticky-posts-from-posts-page/#post-2773298)
 * If you are using the sidebar-page.php template that comes with T11, make a copy
   of sidebar-page.php to your child theme’s folder and add the following code just
   before the ‘while ( have_posts() )’ line:
 *     ```
       <?php
       $stickies = get_option('sticky_posts');
       if( $stickies ) {
          $args = array( 'ignore_sticky_posts' => 1, 'post__not_in' => $stickies );
          global $wp_query;
          query_posts( array_merge($wp_query->query, $args) );
       }
       ?>
       ```
   
 *  Thread Starter [diagrammar](https://wordpress.org/support/users/diagrammar/)
 * (@diagrammar)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/remove-sticky-posts-from-posts-page/#post-2773359)
 * Thanks, copied sidebar-page.php and added code but no change to the “Ticker” 
   page.
 * Do i need to put something into the Child Theme stylesheet that tells it to use
   sidebar-page.php from the child theme folder?
 * The sidebar-page.php in my child theme folder now begins like this:
 *     ```
       get_header(); ?>
   
       		<div id="primary">
       			<div id="content" role="main">
       <?php
       $stickies = get_option('sticky_posts');
       if( $stickies ) {
          $args = array( 'ignore_sticky_posts' => 1, 'post__not_in' => $stickies );
          global $wp_query;
          query_posts( array_merge($wp_query->query, $args) );
       }
       ?>
   
       				<?php while ( have_posts() ) : the_post(); ?>
       ```
   
 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/remove-sticky-posts-from-posts-page/#post-2773361)
 * No, that should do it. To be sure that you are using the correct template, change
   the get_header() line to this:
 *     ```
       get_header(); ?><!-- file:sidebar-page.php in child theme -->
       ```
   
 * Then view the page, look at the source, and search for file:.
 *  [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * (@chipbennett)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/remove-sticky-posts-from-posts-page/#post-2773362)
 * First: if you’re using the static page called “Ticker” for your blog posts index,
   then that page _is **not** using the `sidebar-page.php` template file_. [Per the Template Hierarchy](http://codex.wordpress.org/Template_Hierarchy),
   the Blog Posts index uses, in descending order, _only_ one of the following template
   files:
 * 1. `home.php`
    2. `index.php`
 * So, since Twenty Eleven doesn’t include a `home.php`, the page is actually being
   rendered using `index.php`.
 * That’s really more just FYI, because the solution I propose doesn’t care what
   template file is being used. I would, instead of using `query_posts()`, filter`
   pre_get_posts` instead:
 *     ```
       function mychildtheme_filter_pre_get_posts( $query ) {
           if ( is_page( get_option( 'page_for_posts' ) ) ) {
               $query->set( 'ignore_sticky_posts', true );
           }
           return $query;
       }
       add_filter( 'pre_get_posts', 'mychildtheme_filter_pre_get_posts' );
       ```
   
 * Add that to your child Theme’s `functions.php file`. It tells WordPress: “if 
   this page is the page used to display the blog posts index, then modify the query
   to ignore sticky posts.”
 * The great benefit of this method (in addition to being, generally, cleaner) is
   that the query is modified _before_ posts are queried – meaning that everything–
   including pagination – will work entirely as expected.
 *  [Omnilogic](https://wordpress.org/support/users/omnilogic/)
 * (@omnilogic)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/remove-sticky-posts-from-posts-page/#post-2773363)
 * Hey Chip,
 * Any particular reason you opted to check if it’s the page for posts rather than
   the homepage?
 * This works perfect for me.
 *     ```
       function mychildtheme_filter_pre_get_posts( $query ) {
           if ( is_home() ) {
               $query->set( 'ignore_sticky_posts', true );
           }
           return $query;
       }
       add_filter( 'pre_get_posts', 'mychildtheme_filter_pre_get_posts' );
       ```
   
 *  [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * (@chipbennett)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/remove-sticky-posts-from-posts-page/#post-2773364)
 * > Any particular reason you opted to check if it’s the page for posts rather 
   > than the homepage?
 * Yes: because I didn’t want to assume that you wanted to modify handling of sticky
   posts if you later decided to display the blog posts index on the site front 
   page.
 * As an alternative, you could test for the showcase template itself:
 *     ```
       function mychildtheme_filter_pre_get_posts( $query ) {
           if ( ! is_page_template( 'showcase.php' ) ) {
               $query->set( 'ignore_sticky_posts', true );
           }
           return $query;
       }
       add_filter( 'pre_get_posts', 'mychildtheme_filter_pre_get_posts' );
       ```
   
 * That way, you would only _ever_ see/use sticky posts on a page using the Showcase
   template, regardless of what other template file is loaded.
 *  Thread Starter [diagrammar](https://wordpress.org/support/users/diagrammar/)
 * (@diagrammar)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/remove-sticky-posts-from-posts-page/#post-2773367)
 * Thanks Chip,
 * tried that. it’s much simpler. but still no dice.
 * The page I call “Ticker” is chosen as the “posts page” in the Reading Settings
   of WordPress. When I edit the “Ticker” page, it lists the Template as “Sidebar
   template”
 * How would I alter the code you provided to specify the ignore-sticky-posts command
   for a single page? I want featured (sticky) posts ignored only on the page called“
   Ticker.” They can work normally on all other pages.
 *  Thread Starter [diagrammar](https://wordpress.org/support/users/diagrammar/)
 * (@diagrammar)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/remove-sticky-posts-from-posts-page/#post-2773368)
 * Thanks done…
 * Used Chip’s second suggestion and simply tested for sidebar.php rather than showcase.
   php
 *  [awinter](https://wordpress.org/support/users/awinter/)
 * (@awinter)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/remove-sticky-posts-from-posts-page/#post-2773428)
 * Cheers very helpful, was looking for exactly Chip’s solution.

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

The topic ‘Remove sticky posts from "posts page"’ is closed to new replies.

## Tags

 * [Sticky posts](https://wordpress.org/support/topic-tag/sticky-posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 5 participants
 * Last reply from: [awinter](https://wordpress.org/support/users/awinter/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/remove-sticky-posts-from-posts-page/#post-2773428)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
