Community Forums › Forums › Archived Forums › General Discussion › Genesis_custom_loop next page link does not work on homepage.
Tagged: genesis custom loop, genesis homepage, genesis_custom_loop, homepage, next page link, pagination
- This topic has 4 replies, 4 voices, and was last updated 11 years, 6 months ago by
bittheory.
-
AuthorPosts
-
December 9, 2013 at 10:10 am #77837
[email protected]
MemberI've created a template with a custom loop and set it as my homepage. Everything works fine when the page is not set as the homepage, but when I do, the 'next page' link stops working.
This is because, when I set the page as the homepage, the next page link drops the page slug from the link.
So, instead of
http://mysite.com/my-custom-loop-page/page/2/
it gets changed to
http://mysite.com/page/2/
and the loop just starts over again.What I really need is someway to conditionally change the next page link so that it will work on the homepage.
If it's any help, here's the template:/* Template Name: Newsroom */ /*Use the Genesis custom loop to create loop for my custom post type *For parameters see: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters*/ function newsroom_custom_loop() { global $paged; global $query_args; $args = array( 'thumb' => true, 'post_type' => 'post', 'author' => '16', 'paged' => $paged, 'posts_per_page' => 8 ); return genesis_custom_loop( wp_parse_args($query_args,$args) ); } add_filter( 'genesis_loop', 'newsroom_custom_loop'); genesis();February 19, 2014 at 11:47 am #91197Susan
ModeratorHi! Since it's been a while since you posted your question, I hope you were able to get it resolved.
If not, please report back here, and I will try to assist, or will escalate.
Thanks!
April 16, 2014 at 4:59 pm #100847bittheory
MemberHi,
Hope it's okay to post. I have the same problem - the page slug is dropped in pagination buttons when page is set as homepage and posts do not advance but the same page works when not set as hompage. Did you resolve the problem and if so, how?
Regards,
FredApril 20, 2014 at 10:10 pm #101580davebonds
MemberTry adding your page slug as a pagename parameter to the query args. Replace sample-page with your page slug:
'pagename' => 'sample-page',So this:
$args = array( 'thumb' => true, 'post_type' => 'post', 'author' => '16', 'paged' => $paged, 'posts_per_page' => 8 );Becomes this:
$args = array( 'thumb' => true, 'post_type' => 'post', 'author' => '16', 'pagename' => 'sample-page', 'paged' => $paged, 'posts_per_page' => 8 );April 24, 2014 at 3:47 pm #102234bittheory
MemberHidavebonds,
Thanks for that. Sorry for the delay in responding. Going to go try that out - I'm guessing that combining the above with is_front_page will allow for customizing it only for home. Might need to also check if a static page is used as well. Or I could be over complicating things. Will play with it and see what happens!
Regards,
Fred -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.