pagination not working in Blog Template

Community Forums Forums Design Tips and Tricks pagination not working in Blog Template

This topic is: resolved

This topic contains 5 replies, has 2 voices, and was last updated by  cdils 1 year, 5 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #17261

    CathyT
    Participant
    Post count: 38

    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:

     

    [code]

    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 );
    }[/code]

    #17990

    cdils
    Participant
    Post count: 420

    Hi 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 tweet @cdils.

    #17995

    CathyT
    Participant
    Post count: 38

    Hi 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!

    #18005

    cdils
    Participant
    Post count: 420

    I’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:

    http://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts

    http://www.billerickson.net/customize-the-wordpress-query/

    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 tweet @cdils.

    #18065

    CathyT
    Participant
    Post count: 38

    Thanks 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!

    #18083

    cdils
    Participant
    Post count: 420

    it 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 tweet @cdils.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.