Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Under Reading Settings, I can specify how many blog posts to display on a page. However, I would like to customize this a bit. For example, I want to only display 2 posts on the "/" page, but 3 posts on "/page/2", "/page/3", etc. Any way to customize the homepage to display one less post than the other pages?

share|improve this question
    
possible duplicate of How to show a single post on the front page but have normal paging? –  Jan Fabry Apr 16 '11 at 14:22
    
A simple filter will display posts 1-2 on the front page and 4-6 on the second page, skipping post 3. You need to play with the offset variable yourself to get a good effect. –  Jan Fabry Apr 16 '11 at 14:23
    
I did the same as you did, because I thought the first page was bloated. I've just read about the <!--more--> (codex.wordpress.org/Template_Tags/the_content) and I'm quite happy about it. –  moose Apr 28 '12 at 5:33

2 Answers 2

There is no option to change the number of posts per page, archive, tag or category from the admin but you can use query_posts() posts_per_page to set the number. for example in your theme's index.php file or if you are using a static page as your home_page the page.php file add this snippet of code above the loop

if(is_home() || is_front_page()){
    global $query_string;
    parse_str( $query_string, $args );
    $args['posts_per_page'] = 2;
    query_posts($args);
}

what it does is check to see if you are on the home page or front page and if you are then it changes the number of posts to show.

another example is to show different number of posts for different categories:

global $query_string;
parse_str( $query_string, $args );
if(is_category('cats')){
    $args['posts_per_page'] = 7;
    query_posts($args);
}elseif(is_category('dogs')){
    $args['posts_per_page'] = 4;
    query_posts($args); 
}else{
    $args['posts_per_page'] = 10;
    query_posts($args);     
}

here we use the conditional tag is_category() to check which category we are in based on that we set the number of posts to display. For cats we set 7, for dogs we set 4 and if its just random category we display 10.

share|improve this answer

http://coffee2code.com/wp-plugins/custom-post-limits/

By default, WordPress provides a single configuration option to control how many posts should be listed on your blog. This value applies for the front page listing, archive listings, category listings, tag listings, and search results. Custom Post Limits allows you to override that value for each of those different sections.

Specifically, this plugin allows you to define limits for:

  • Authors archives (the archive listing of posts for any author)
  • Author archives (the archive listing of posts for any specific author)
  • Categories archives (the archive listings of posts for any category)
  • Category archive (the archive listings of posts for any specific category)
  • Date-based archives (the archive listings of posts for any date)
  • Day archives (the archive listings of posts for any day)
  • Front page (the listing of posts on the front page of the blog)
  • Month archives (the archive listings of posts for any month)
  • Search results (the listing of search results)
  • Tags archives (the archive listings of posts for any tag)
  • Tag archive (the archive listings of posts for any specific tag)
  • Year archives (the archive listings of posts for any year)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.