Community Forums › Forums › Archived Forums › Design Tips and Tricks › Magazine Pro – Adding pagination to bottom of homepage
Tagged: front page, Magazine Pro, pagination
- This topic has 20 replies, 2 voices, and was last updated 7 years, 7 months ago by Brad Dalton.
-
AuthorPosts
-
November 26, 2016 at 12:33 am #196644khoyenMember
Hi guys,
I've been struggling to add numeric pagination at the bottom of my blogs homepage.
I added this code from the following article to my frontpage.php...http://wpsites.net/web-design/add-custom-genesis-loop-with-pagination-after-front-page-widgets/.
Pagination was added to the page, but it was added to my right rail instead of under the last featured blog post on the homepage.
Does anyone know what I need to do to fix this?
Thanks!
http://www.gentlemanwithin.comNovember 27, 2016 at 3:05 am #196690Brad DaltonParticipantI updated the code and tested it so the loop and pagination display after the widgets.
November 29, 2016 at 11:33 pm #196806khoyenMemberThanks! I'll have to try it again this weekend.
December 3, 2016 at 11:15 pm #196960khoyenMemberThanks again for the fix. It worked, but there seems to be a small issue.
Link to screenshot for reference: https://www.dropbox.com/s/5wmpuu7fflt03zv/Screen%20Shot%202016-12-04%20at%2012.13.21%20AM.png?dl=0
December 3, 2016 at 11:20 pm #196961khoyenMemberOne more thing I noticed...I have 7 blog posts to display on the homepage and then pagination begins...But it seems that after the 7th post all the way at the bottom, instead of displaying the 8th and beyond...it is repeating post 1-7 over again without the feature image displayed. Know what could be causing this?
Link to screenshot: https://www.dropbox.com/s/ouk9lf1x1721zzk/Gentleman%20Within%20-%20Style%20For%20The%20Conscious%20Man%20%2820161204%29.jpg?dl=0
December 4, 2016 at 7:08 am #196970Brad DaltonParticipantDecember 4, 2016 at 3:01 pm #197009khoyenMemberWith a direct copy and paste of the code in this link http://wpsites.net/web-design/add-custom-genesis-loop-with-pagination-after-front-page-widgets/ to the end of my front-page.php, this is the result I'm getting. You can view it live on my site here: http://gentlemanwithin.com/
December 4, 2016 at 3:08 pm #197010Brad DaltonParticipantDecember 4, 2016 at 3:23 pm #197012khoyenMemberhmmm...it seems to be appearing like this: https://www.dropbox.com/s/ouk9lf1x1721zzk/Gentleman%20Within%20-%20Style%20For%20The%20Conscious%20Man%20%2820161204%29.jpg?dl=0 in Chrome. But in Safari and Firefox, like you said, there's no pagination at all.
December 5, 2016 at 5:43 am #197038Brad DaltonParticipantMake sure you only use 1 instance of the following:
remove_action( 'genesis_loop', 'genesis_do_loop' );
Not sure what is causing the issue because i don't have all your code.
December 6, 2016 at 12:06 am #197106khoyenMemberSo I only included one instance of that code you mentioned.
The code I've pasted below is what I have at the end of my front-page.php file. It seems like everything is displaying properly now, except one thing which was an issue from before. When I click over to the "next page >>" all of the articles are repeating themselves...
/**
* @author Brad Dalton
* @example http://wpsites.net/
* @copyright 2014 WP Sites
*/
function wpsites_custom_grid_loop() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 0,
'feature_image_size' => 0,
'feature_content_limit' => 0,
'grid_image_size' => 0,
'grid_content_limit' => 250,
'more' => __( '[Read more]', 'wpsites' ),
) );
} else {
genesis_standard_loop();
}
}
add_action( 'genesis_after_loop', 'genesis_posts_nav' );
genesis();December 10, 2016 at 2:49 pm #197409khoyenMemberAny advice on how to get the articles to not repeat themselves on the next page?
December 11, 2016 at 8:26 pm #197434khoyenMemberFor reference, this is what the code looks like on my front-page.php
<?php
/**
* This file adds the Home Page to the Magazine Pro Child Theme.
*
* @author StudioPress
* @package Magazine Pro
* @subpackage Customizations
*/add_action( 'genesis_meta', 'magazine_home_genesis_meta' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function magazine_home_genesis_meta() {if ( is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-middle' ) || is_active_sidebar( 'home-bottom' ) ) {
// Force content-sidebar layout setting
add_filter( 'genesis_site_layout', '__genesis_return_content_sidebar' );// Add magazine-home body class
add_filter( 'body_class', 'magazine_body_class' );// Remove the default Genesis loop
remove_action( 'genesis_loop', 'genesis_do_loop' );// Add homepage widgets
add_action( 'genesis_loop', 'magazine_homepage_widgets' );}
}function magazine_body_class( $classes ) {
$classes[] = 'magazine-home';
return $classes;}
function magazine_homepage_widgets() {
genesis_widget_area( 'home-top', array(
'before' => '<div class="home-top widget-area">',
'after' => '</div>',
) );genesis_widget_area( 'home-middle', array(
'before' => '<div class="home-middle widget-area">',
'after' => '</div>',
) );genesis_widget_area( 'home-bottom', array(
'before' => '<div class="home-bottom widget-area">',
'after' => '</div>',
) );}
/**
Pagination
*/function wpsites_custom_grid_loop() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 0,
'feature_image_size' => 0,
'feature_content_limit' => 0,
'grid_image_size' => 0,
'grid_content_limit' => 250,
'more' => __( '[Read more]', 'wpsites' ),
) );
} else {genesis_standard_loop();
}
}
add_action( 'genesis_after_loop', 'genesis_posts_nav' );
genesis();
December 11, 2016 at 9:59 pm #197438Brad DaltonParticipantLooks like you're missing the action hook for the wpsites_custom_grid_loop function.
December 11, 2016 at 11:02 pm #197439khoyenMemberHow should I go about applying that function?
December 11, 2016 at 11:18 pm #197440Brad DaltonParticipantDecember 12, 2016 at 9:53 pm #197501khoyenMemberWhen I add the following piece of code....add_action( 'genesis_loop', 'wpsites_custom_grid_loop', 15 ); ... it reverts to the same issue I was talking about before how the numeric paginations appears twice and the articles are not appearing as they should. If you can take a look at my site, you'll see what I'm talking about.
December 13, 2016 at 4:39 pm #197547khoyenMemberYou had mentioned last week that based on your testing, everything worked fine. If you don't mind me asking, can you send me the code that you used?
March 2, 2017 at 8:19 pm #202385khoyenMemberI don't mean to keep beating a dead horse with this one, but I've yet to resolve this pagination issue and it's driving me crazy. I've asked so many developers and no one seems to know any answers.
Anyone out there who may be able to assist or take a look at what may be going wrong with this?
Thank you.
March 4, 2017 at 5:01 pm #202468khoyenMemberAfter reaching out to StudioPress support, they were able to assist me in resolving the issue.
You can't have any widgets in the HOME area. Took those out and now pagination works.
Set as resolved.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.