WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Twenty Eleven - Remove featured posts from default posts page (6 posts)

  1. awinter
    Member
    Posted 1 year ago #

    Hi,

    I have a site using a child theme of twenty eleven. I have a showcase template as the home page displaying sticky posts in the slider. I have a page called 'blog' set as the default posts page. Since I have any featured posts displaying as sticky posts on the homepage slider I would like to 'hide featured posts' from the default 'posts page' (ie the blog) - as they always appear at the top.

    Any help gratefully received.

    ;o)

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    You'd need to exclude the sticky posts from the main Lop using a custom query. See:
    http://codex.wordpress.org/Function_Reference/query_posts
    http://codex.wordpress.org/Function_Reference/WP_Query

  3. awinter
    Member
    Posted 1 year ago #

    Thanks Esmi will give it a go ;o)

  4. awinter
    Member
    Posted 1 year ago #

    Used the solution below filtering them out in functions.php as posted in

    http://wordpress.org/support/topic/remove-sticky-posts-from-posts-page?replies=9

    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' );
  5. radleycollector
    Member
    Posted 1 year ago #

    Hi, Will this code work for my website? I'm having the same issue, i use a slider here : http://www.radleycollector.com but cant stop the slider posts because they are a sticky they are appearing on my blog page http://www.radleycollector.com/blogwhen i dont want them too :(

    i have found my functions.php file but have no idea where abouts to put the code and do i change where mychildtheme is and change to pinboard as thats my theme

    Really would appreciate some help please. I'mnot good with code so simple as you can for the blond please hehe :)

    xx

  6. awinter
    Member
    Posted 1 year ago #

    Hi Radley.

    First off you need to be sure to be using a "child" of your theme (i.e. a copy that you can edit, not the original theme itself). You can read up on it here or many posts on the forum: http://codex.wordpress.org/Child_Themes

    I added the code to the bottom of the functions.php, which was fine for me, although not sure if your theme uses the same methods and stickies as twenty eleven. Keep a copy of your original code as a backup then give it a go - you can always revert back to original if it doesn't work. As long as you are using a child theme then you shouldn't need to change mychildtheme.

    Have you tried the support for the theme? http://wordpress.org/support/theme/pinboard

Topic Closed

This topic has been closed to new replies.

About this Topic