• 0
Sign in to follow this  
Followers 0

Different number of posts on each page

Question

Posted · Report post

Hi i was looking for a way to display a different number of posts on different pages. For example i would like only 1 or 2 posts to appear on the front page but say 7 or 8 in my category pages. Is there any way to do this? Regards Luke http://www.danceyrselfclean.com

Share this post


Link to post
Share on other sites

8 answers to this question

  • 0

Posted · Report post

Hey Luke, You could add a hook to the functions.php file. Basically, the hook would use if statements to say, basically: if this page, then query_posts('posts_per_page=x')... Make sense?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Would i be able to stick something in the custom CSS section to get it to work. Does something like this look along the right lines function limit_posts_per_archive_page() { if ( is_category() ) $limit = 2; elseif ( is_search() ) $limit = 1; else $limit = get_option('posts_per_page'); set_query_var('posts_per_archive_page', $limit); } add_filter('pre_get_posts', 'limit_posts_per_archive_page');

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

What you've posted above is not CSS but a script, thus it would likely crash your site if placed in CSS Rules.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

First, in reply to your earlier query, you can control the number of posts on your front page (presuming it's static) you can use a plugin called TPG Get Posts there, with 2 posts. For the rest, you can simply change the settings for the number of posts to display at Settings > Reading on the left column of the WP Admin Dashboard.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Here's the link: http://wordpress.org/extend/plugins/tpg-get-posts/

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Im not using a static page so i dont think that would work

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Have you seen this plugin?: http://www.maxblogpress.com/plugins/dppp/

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Here's another plugin: http://wordpress.org/extend/plugins/custom-posts-per-page/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0