[Support request] Setting up standard pagination when using Generate Press with Generate Blocks

Home Forums Support [Support request] Setting up standard pagination when using Generate Press with Generate Blocks

Home Forums Support Setting up standard pagination when using Generate Press with Generate Blocks

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • #2334369
    Chris

    Hi all,

    I’m using the Generate Blocks query loop to display a list of my posts. I have hundreds of posts and need to paginate the list.

    Before Generate Blocks, I was using WP show posts, and my paginated links where like /page/2/, /page/3/, /page/4/, etc…

    I want to continue using those same link urls, but using Generate Blocks pagination, the links are set up like: ?query-7edb629a-page=2, ?query-7edb629a-page=3, ?query-7edb629a-page=4

    I’ve set up my htaccess rewrite to deliver ?query-7edb629a-page=2 when /page/2/ is accessed. That works.

    Now, however, I need to set up the pagination links so the urls are formatted like /page/2/

    So, rather than using the Generated Blocks pagination, I thought I could set up just a standard wp/Generate Press pagination, doing something like this:

    add_action('generate_after_content', function(){
    	
    	if ( is_page(44842) ) : //home page  
    		the_posts_pagination( array(
    			'mid_size' => 2,
    			'prev_text' => __( 'Previous Page', 'textdomain' ),
    			'next_text' => __( 'Next Page', 'textdomain' ),
    ) );
    			do_action( 'generate_paging_navigation' );
    		endif;
    });

    I based that off of some other code I found here on the forum for displaying pagination.

    But I don’t get any results. Empty space.

    Will this code not work for me, is it because I’m using Generate Blocks instead of the default query loop? Seems like it should still provide the standard wp pagination, no?

    Appreciate any help or thoughts about a solution,

    Chris

    #2335270
    Chris

    If this is too much to ask for help with on the forum here, do you all have recommendations for freelance coders that are familiar with GP and GB?

    Chris

    #2335282
    David
    Staff
    Customer Support

    Hi there,

    apologies, your original topic slipped through our system.

    By default no, there is an option built into the Query Loop for Inheriting Query from Template, which is an option for when using the query loop from inside a template, and that option will use paginated /page/2 URLs.

    But you would have to hook the query loop into the themes archive pages.

    Is that an option ?

    In the meantime i have asked Tom if that can be enabled using a filter on static pages.

    #2335305
    Chris

    Oh, so it’s because the page is static?

    I had just been testing this on my (static based) home page, but because I used WP Show Posts before, my category pages are also static based as well. Each created separately with their own content and then WP Show Posts used to display the posts.

    So… hmmm… do please let me know if Tom has a solution, that would be a lot easier. Pagination did work with /page/2/ formatted links with WP Show Posts, so it seems like this would still be possible. It’s tempting to just switch back to Show Posts, but I’d rather move forward with something that stays updated.

    I am using the pro version of both Generate Press and Generate Blocks, if that makes any difference,

    Chris

    #2335385
    Chris

    If you want to take a look at what I am doing, it’s at https://consumer.press I have three query loops, but am looking to implement the third/largest one, so https://consumer.press/page/2/ would display the second page of that query loop, https://consumer.press/page/3/ the third, etc… that’s set up in htaccess using: RewriteRule ^page/([^/]*)/$ /?query-7edb629a-page=$1 [L]

    They are a bit slow to load, I figured I’d work on that after I get this basically working. May need to included fewer posts…

    #2335419
    Tom
    Lead Developer
    Lead Developer

    Hey Chris,

    Right now it’s not possible to use the standard loop pagination (/page/2) without using the “Inherit” option and placing the Query Loop on a page that would typically have pagination (an archive, blog page etc…).

    In GPP 2.2.0 it will be possible to use the Query Loop block to build those pages, but it’s not possible yet, unfortunately.

    #2337049
    Chris

    Okay, thank you Tom, I’ll have to fake it in the meantime and look forward to 2.2.0 🙂

    #2367378
    Chris

    I’m trying out the 2.2 beta – how would I go about setting up the /page/2/ formatted navigation links?

    I looked and I don’t see any documentation on it yet, but if I missed it please let me know the url,

    Thanks,

    Chris

    #2367603
    David
    Staff
    Customer Support

    Hi there,

    in GPP 2.2 we added the Loop Template block element which is what you can now use to build your Archive Pages using the query loop.

    You would need to use that method in order to use the regular paging navigation.

    #2369391
    Chris

    Okay, I set up an element block, set the element type to loop template… then?

    I want to set up navigations links, just the standard 1, 2, 3… 400 with the urls formatted as /page/2, page/3, etc.

    I wish I was fluent in generatepress, but I’m not at this point. Is the loop template block set up outside of the query loop block displaying the posts? Inside somehow? I really don’t understand. Is there documentation on this out yet?

    Thanks,

    Chris

    #2369397
    Fernando
    Customer Support

    Hi Chris,

    Here’s the article with regards to the Loop Template – Block Element: https://docs.generatepress.com/article/block-element-loop-template/

    You’ll need to create a Loop Template, then add a Query Loop there, and enable inherit Query from template as mentioned in the article.

    Let us know how it goes.

    #2377123
    Paul

    Did anyone get this figured out.

    I followed the steps on the article, but it wasn’t clear on Location for the Element -> Loop Template.

    After the loop template is set-up, I added a Query Block from GPpro, but I couldn’t get it working.

    I’ve got several pages set-up that I’d like to turn into archives of sorts. Will I need an element for each page?

    Is there a more thorough step-by-step?

    Thanks for any help.

    #2377219
    David
    Staff
    Customer Support

    Hi there,

    the Block Element – Loop template will only replace the Themes Archive templates, it won’t act as a substitute for static pages.

    If you’re wanting to rebuild the themes archive template, then follow that doc and set the Location to your require archives.

    eg. blog or All Archives or Post Category Archives etc. or any combination of.

    Let me know

    #2377220
    David
    Staff
    Customer Support

    Hi there,

    the Block Element – Loop template will only replace the Themes Archive templates, it won’t act as a substitute for static pages.

    If you’re wanting to rebuild the themes archive template, then follow that doc and set the Location to your require archives.

    eg. blog or All Archives or Post Category Archives etc. or any combination of.

    Let me know

    #2377732
    Chris

    Yeh, I still don’t follow this either… and if I select inherit Query, then I don’t have access to the custom parameters I need. So… I’m not sure how this helps me set up a navigation menu that allows users/search engines to browse older posts with the standard url structure (site.com/page/2, site.com/page/3…)

    Chris

Viewing 15 posts - 1 through 15 (of 26 total)
  • You must be logged in to reply to this topic.