Show 1 full post on front page, but show 10 excerpts on archive pages.

  • Bradley Anderson

    #6173

    I can do one or the other, but I can’t figure out how to do both. Hopefully someone knows of a way to do it without hard-coding either the theme or WP so I don’t lost my customizations after each update? Any help would be greatly appreciated. – Brad

    http://www.latchkey-productions.com

    Anonymous

    #33551

    Go to Settings –> Reading Settings and put 1 in Blog pages show at most. Then add this to child-theme’s functions.php file (put the code anywhere between opening <?php and closing ?> php tags)

    function posts_on_category_archive($query){
    if ($query->is_category) {
    $query->set('posts_per_page', 10);
    }
    return $query;
    }

    add_filter('pre_get_posts', 'posts_on_category_archive');

    Moved to Support. Please post in the correct section next time.

Viewing 2 posts - 1 through 2 (of 2 total)

  • You must be logged in to reply to this topic.