Question

I am attempting to exclude all sticky posts from my front page in twenty twelve theme. I have attempted the following. I am making all changes to the child theme.

  1. To remove the following code from content.php

    <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
    <div class="featured-post">
        <?php _e( 'Featured post', 'twentytwelve' ); ?>
    </div>
    <?php endif; ?>
    
  2. Add following code to index.php before the loop(this removed sticky posts but broke pagination)

    <?php query_posts( array( 'post__not_in' => get_option( 'sticky_posts' ) ) ); ?>
    

This is the loop in index.php (pretty much standard index.php for twenty twelve.

        <?php while ( have_posts() ) : the_post(); ?>
            <?php get_template_part( 'content', get_post_format() ); ?>



        <?php endwhile; ?>


        <?php twentytwelve_content_nav( 'nav-below' ); ?>

Could someone please advise me on what I should exactly put into this loop to not show any sticky posts on index.php?

Thank you for your time.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top