Community Forums › Forums › Archived Forums › Design Tips and Tricks › Adjust pagination Eleven40 theme
Tagged: Eleven40, pagination
- This topic has 4 replies, 2 voices, and was last updated 12 years ago by
Brad Dalton.
-
AuthorPosts
-
November 4, 2014 at 7:20 am #130399
winnydejong
MemberHi,
I use the Eleven40 theme on my blog: http://datajournalistiek.nl/. On the homepage you see 5 posts, while on all others you'll see 10. I've set the number of posts to show to 10 in the regular settings, and adjusted the number of posts on the homepage to 5 by adding the following code to functions.php:
//* Show only 5 posts on frontpage add_action( 'pre_get_posts', 'change_num_posts_in_grid' ); function change_num_posts_in_grid( $query ) { global $wp_the_query; if( $query->is_main_query() && is_home() && !is_paged() ) { $query->set( 'posts_per_page', '5' ); } }But I've found that the pagination doesn't change accordingly. At the homepage it looks like there are 29 pages. In reality there are only 15 pages, 'cause of all pages except the homepage showing 10 posts, not 5. How do I correct the pagination on the homepage?
Thanks in advance. Best regards, Winny
http://datajournalistiek.nlNovember 4, 2014 at 8:23 am #130407Brad Dalton
ParticipantLink to the source of the code please.
Did you modify the code in anyway like adding
&& !is_paged() ) {I’ve set the number of posts to show to 10 in the regular settings,
The regular settings. Are you referring to the Reading Settings or the Genesis > Theme Settings?
When you refer to home page, are you referring to the front page of your site or the blog page ( posts page )?
November 4, 2014 at 8:37 am #130409Brad Dalton
ParticipantI tested the code and it controls the home page limit.
All other archives are controlled by the Genesis > Theme Settings and the reading settings for the posts page.
November 4, 2014 at 4:27 pm #130486winnydejong
MemberHi Brad,
My Genesis > Theme settings are set to show 10 posts a page. The reading settings are also set to show 10 posts a page.
The code I've added to the funtions.php only influences the front page, which now shows only the 5 latest post.
The problem still remains: when you're on the homepage of datajournalistiek.nl, according to the pagination there are 29 pages. In reality there only 15 pages: on the frontpage the paginations divides the total number of posts by the number of posts you can actually see on the frontpage (5). In reality these 5 posts on the homepage are an exception, since all other pages show 10 posts.
How do I set up the pagination accordingly?
Thanks in advance.
Best, Winny
November 5, 2014 at 3:53 am #130565Brad Dalton
Participant -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.