Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

Varying number of posts on homepage, archive pages


 
Prev Previous Post   Next Post Next
  #1  
Old Dec 12, 2015, 12:06 AM
redacter
 
14 posts · Oct 2009
Varying number of posts on homepage, archive pages

I would like to have a different number of posts displaying on my homepage vs. my archive pages. For example, I only want one post to display on my homepage, but I would like 15 posts to display on category, tag, author pages, etc. This is the code I'm using, in the functions.php file, but it doesn't seem to work.

Any corrections, suggestions, improvements would be greatly appreciated. See the code below:

function number_of_posts_on_archive($query){
if ($query->is_archive) {
$query->set('posts_per_page', 15);
}
return $query;
}

add_filter('pre_get_posts', 'number_of_posts_on_archive');

BTW: my site is www.theimproper.com

Thanks in advance for your assistance.

Keith

Last edited by juggledad; Dec 12, 2015 at 05:16 AM.
 

Bookmarks

Tags
archive pages, display posts, homepage

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to show all posts for the month in archive but only X number in home MacMcClellan Center area post/pages 2 Feb 17, 2013 07:49 AM
No excerpts but entire posts on 1st of my blog's pages archive bigliettaio Excerpts, Read more, Pagination 0 Jun 11, 2011 04:35 PM
[SOLVED] Different number of posts on home and post pages jasonchamb New Versions, & Updating 2 May 10, 2011 01:13 PM
[SOLVED] How can I get more posts to show up on archive/category pages? cowgrrrl Excerpts, Read more, Pagination 6 Jun 26, 2010 12:10 PM
number of excerpts on homepage luc Excerpts, Read more, Pagination 3 Mar 4, 2009 09:38 AM


All times are GMT -6. The time now is 12:30 PM.


Powered by vBulletin® Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.