- This topic has 22 replies, 2 voices, and was last updated 3 years, 1 month ago by
David.
-
AuthorPosts
-
February 6, 2023 at 6:44 am #2523167
Benny
Ist this doable with the loop template or do i have to to this with css afterwards?
Link to the picture –> https://ibb.co/TYQZrgW
February 6, 2023 at 7:02 am #2523184Benny
For the greater “picture”, i want the first 4 posts to be like this, then hook something in between and afterwards, there are normal posts that are older and behave “normal”. I attached a picture to better explain what i want to do.
February 6, 2023 at 8:36 am #2523396David
StaffCustomer SupportHi there,
is this just for the Blog page or All Archive pages ?
February 6, 2023 at 8:48 am #2523407Benny
All archives
February 6, 2023 at 10:20 am #2523495David
StaffCustomer SupportTo create a Loop template that has a separate hero loop and a main loop
Ok, its possible, but its quite complicated and theres currently a pagination bug that will be fixed in GB 1.7.
The steps would be:
1. Add new Loop template.
2. Add a Container for the hero, inside add 2 column grid.
3. In each column add a query loop –
3.1 first loop will be to show one posts and should have a class oflist-one
3.2 second loop to show the the other column with the next 3 posts and should have a class oflist-two
4. After this your static section.
5. Then your final loop to show the rest of the posts with a class oflist-threeNOTES:
For All query loops: enable:Inherit the Query from TemplateDO NOT set any Parameters
The class should get added the Advacned > Additional CSS Class(es) of the Query Loop -> Grid Block6. The display rules location should be set to ALL Archives.
7. Publish thatNow each of the posts lists needs it paging and offet params set. To do this you can use the
generateblocks_query_loop_argsfilter hook – heres an example of that code: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 ) { return array_merge( $query_args, array( 'offset' => 4, ) ); } } return $query_args; }, 10, 2 );For the bug, the offets aren’t getting applied to the Query Loops Pagination so it can lead to a mismatch when used.
Its being fixed in 1.7 which should be out mid february.
`February 7, 2023 at 2:41 am #2524189Benny
Works just fine –> http://app-gulgowski.2xaf1tm1wr-rz83ynk206d7.p.temp-site.link/category/thailand/
Thank you <3
PS: I upgraded to GB 1.7 (because this site wont go online before mid february) and i love it!
February 7, 2023 at 2:44 am #2524192Benny
One thing i forgot to mention: The isnt exactly right. Do you have an idea why this is?Nevermind, i duplicated blogposts and didnt change the time. Its working just fine. Thanks again.
February 7, 2023 at 5:13 am #2524349David
StaffCustomer SupportOH wow, i am amazed – i wrote that on the fly and it worked 🙂
Glad to hear that!
February 21, 2023 at 1:34 pm #2541744Benny
One thing that does not seem to work is pagination. Any idea how to fix this?
Thank you!!
February 22, 2023 at 4:35 am #2542426David
StaffCustomer SupportWe just released GenerateBlocks 1.7 which fixes the Query Loops pagination “bug” so that filter should apply to pagination too.
Let me know
February 22, 2023 at 4:51 am #2542438Benny
I thought so, thats why i build it with 1.7 after you mentioned it. Maybe you have a clue why its not working here –> http://app-gulgowski.2xaf1tm1wr-rz83ynk206d7.p.temp-site.link/thailand/
February 22, 2023 at 7:00 am #2542567David
StaffCustomer SupportDid you add the Pagination block to the Query Loop block ? Its an option the query loop blocks toolbar.
February 22, 2023 at 7:05 am #2542576Benny
I did, yes.
February 22, 2023 at 9:31 am #2542922David
StaffCustomer SupportAnd silly question. I assume there is enough posts to trigger the need for pagination ?
February 22, 2023 at 9:37 am #2542933Benny
Yes 😁
If you want to, i can send you credentials and you can have a look into it.
-
AuthorPosts
- You must be logged in to reply to this topic.