- This topic has 22 replies, 2 voices, and was last updated 3 years, 1 month ago by
David.
-
AuthorPosts
-
February 22, 2023 at 10:10 am #2542980
David
StaffCustomer Support🙂 ok, if you can provide the login in the private info field we can take a look
February 22, 2023 at 10:19 am #2542992Benny
Here we go
February 23, 2023 at 6:19 am #2543945David
StaffCustomer SupportWhat happens if you remove the current Query Loop in your loop template, and add a new query loop ?
You may want to Quick Edit and set the status to Draft for the current element and make a new one to test.Just wondering if its holding onto the legacy code.
February 23, 2023 at 7:10 am #2543995Benny
It worked until i added the list-three class to the query grid 😀
It works with my query loop IF i remove the list-three class. So maybe something isnt quite right. If you want to look into it, you have my credentials. And again, thank you for your great work. I appreciate it alot!
February 23, 2023 at 8:29 am #2544232David
StaffCustomer SupportYeah it must be the code, if you can bear with me whilst i look into it 🙂
February 24, 2023 at 1:43 am #2545089David
StaffCustomer SupportOK, so now i find out that using
offsetbreaks pagination when inheriting the query.
Which can be a bit of a pain, as it means creating our own offset param when the page is paged, which can lead to some weird side effects.But i tested this on a local dev site, and it looks to be working:
add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) { // Check your logic to apply the filtering only to specific loop if ( !empty( $attributes['className'] ) && ! is_admin() ) { // list-one set pages to 1 and offset by 0 if ( strpos( $attributes['className'], 'list-one' ) !== false ) { return array_merge( $query_args, array( 'posts_per_page' => 1, 'offset' => 0, ) ); } // list-two set pages to 3 and offset by 1 elseif ( strpos( $attributes['className'], 'list-two' ) !== false ) { return array_merge( $query_args, array( 'posts_per_page' => 3, 'offset' => 1, ) ); } // list-three offset by 5 elseif ( strpos( $attributes['className'], 'list-three' ) !== false ) { $paged = get_query_var('paged') ? get_query_var('paged') : 1; $posts_per_page = 6; // Set the posts per page here $offset = ($paged - 1) * $posts_per_page + 3; // 3 is the offset value return array_merge( $query_args, array( 'posts_per_page' => $posts_per_page, 'offset' => $offset, ) ); } } return $query_args; }, 10, 2 );Note that you have to define the
posts_per_pagein the code.Do you want to give that a try ?
February 24, 2023 at 4:44 am #2545330Benny
Works like charm.
Do you have a clue how to get rid of the empty fourth category page?(Fixed this with Settings > Reading > Blog pages show at most = 13).February 25, 2023 at 3:04 am #2546313David
StaffCustomer SupportGlad to hear you found a solution.
Ill take a look into how we can make this kind of easier to do! -
AuthorPosts
- You must be logged in to reply to this topic.