Community Forums › Forums › Archived Forums › Design Tips and Tricks › pagination not working in Blog Template
Tagged: blog template, custom templates, pagination
- This topic has 5 replies, 2 voices, and was last updated 11 years, 10 months ago by cdils.
-
AuthorPosts
-
February 1, 2013 at 6:13 pm #17261Cathy @ WPBaristaMember
I've been working on this for HOURs. I've tried custom widget areas instead, and static pages, finally settled on using the Blog template, and overwriting the page_blog.php template in the child theme with this: (which is showing pagination, but when arriving at the /page/2 and page/3/ etc, there are only the original posts showing:
remove_action( 'genesis_loop', 'genesis_do_loop' ); add_action( 'genesis_loop', 'child_do_blog_loop' ); function child_do_blog_loop() { $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; $query_args = wp_parse_args( genesis_get_custom_field( 'query_args' ),array( 'offset' =>5, 'showposts' => 10, 'paged' => $paged ) ); genesis_custom_loop( $query_args ); }
Visit WP Barista to download 52 Quick Edits You Can do Today to Get More Clicks / Views / Sales. I also do paid support (starting at $75) and fully custom Genesis Child Themes.February 4, 2013 at 3:00 pm #17990cdilsParticipantHi Cathy,
Can you post a link to a page using your page_blog.php template?
Just to clarify, do you mean that your < Older Posts & Newer Posts links aren't showing?
Carrie
Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. 🙂
I host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.
February 4, 2013 at 3:04 pm #17995Cathy @ WPBaristaMemberHi Carrie,
I had to re-do the whole thing many times. It turns out that WP wp_query and query_posts both don't like to offset & posts_per_page at the same time.
The page navigation was showing up - but regardless of which page you were on, it always showed the content that should have been on page 1. Very weird. We had to compromise on our results in this case.
Thank you for offering your assistance!
Visit WP Barista to download 52 Quick Edits You Can do Today to Get More Clicks / Views / Sales. I also do paid support (starting at $75) and fully custom Genesis Child Themes.February 4, 2013 at 3:12 pm #18005cdilsParticipantI've read several blog posts recently about going when to use wp_query vs query_posts. Here's a couple of them in case they might be helpful to you:
Feel free to post followup questions if you want to muddle through anything together.
Cheers,
Carrie
Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. 🙂
I host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.
February 4, 2013 at 5:01 pm #18065Cathy @ WPBaristaMemberThanks Carrie. I did read those ones too, I spent way too much (unpaid) time on this! Apparently paging has to be run through the wp_query which I did several times, using many code snippets from people much smarter than me. THen through many more searches read one of the WP developers discussing that it isn't possible to use offset & paginationin the same query. So the alternative suggestion is to preclude duplicate posts from the other loops on the page. But that created a new set of requirements from the client, so we negotiated on some expectations. Like how I said that? Negotiated on expectations. lol Have a great day!
Visit WP Barista to download 52 Quick Edits You Can do Today to Get More Clicks / Views / Sales. I also do paid support (starting at $75) and fully custom Genesis Child Themes.February 4, 2013 at 5:32 pm #18083cdilsParticipantit isn’t possible to use offset & pagination in the same query.
Glad to know that! Sorry you got there the long way. 🙁
Good luck with those expectations and negotiations!! 🙂
Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. 🙂
I host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.