- This topic has 12 replies, 4 voices, and was last updated 1 year, 5 months ago by David.
-
AuthorPosts
-
September 22, 2022 at 11:01 pm #2351279Joy
Hi GP team,
On our home page, I’ve added a query loop at the top of the page (based on the “image at left” query pattern block) and would like this to show a single sticky post (so whatever the most recently published post that has been designated as a sticky post). In the display settings, I’ve selected “items per page” as 1 and “max pages to show” as 1. I’ve published, cleared cache etc, but it’s still showing multiple sticky posts instead of just 1. I’ve tested this on a brand new page and it works fine so I’m not sure why it’s showing multiple posts on the home page.
Would you be able to suggest anything to try here?
Many thanks in advance!
September 22, 2022 at 11:07 pm #2351282Fernando Customer SupportHi Joy,
This issue will be addressed in the upcoming update. For now, can you try adding
sticky-loop
to the class list of the Grid Block inside the Query loop? Then, add this PHP:add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) { if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'sticky-loop' ) !== false ) { $query_args['ignore_sticky_posts'] = true; } return $query_args; }, 10, 2 );
Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets
The Alternative would be to download the current release candidate versions in https://generateblocks.com/account/
September 23, 2022 at 1:49 am #2351405JoyMany thanks Fernando – do you know roughly when the next update will be ready?
September 23, 2022 at 1:55 am #2351411Fernando Customer SupportYou’re welcome Joy! The upcoming update has already passed the alpha and beta testing, and is already in the Release Candidate category. It should be anytime soon.
September 23, 2022 at 2:02 am #2351415JoyOk perfect, I think I’ll wait it out. Much appreciated!
September 25, 2022 at 5:02 pm #2353534Fernando Customer SupportYou’re welcome Joy!
October 14, 2022 at 3:45 pm #2373977JoyHi again Fernando, hope all is well. I see the update came through which I’ve done but seem to be having the same problem. Is there something I’m doing wrong / could do to make this work properly? Thanks so much!
October 14, 2022 at 3:50 pm #2373980YingStaffCustomer SupportHi Joy,
You are using the WP query loop block, I think Fernando thought you were using the GenerateBlocks query loop block.
And the update he mentioned is the GenerateBlocks plugin.
Can you try that?
https://docs.generateblocks.com/article/query-loop-overview/October 14, 2022 at 11:00 pm #2374082JoyThanks Ying, apologies! I can’t seem to figure out how to get the GeneratesBlocks Query loop to work in the same way with the image on the left and the content title, date and excerpt on the right. Is there an article on how to do this? The query loop and grid seems to only allow 1 container per post and no option to format the text to the right of the image. Many thanks!
October 14, 2022 at 11:58 pm #2374101JoyHi again Ying, I think I’ve worked it out using columns and two separate query loops but please do let me know if you see any issues with this approach?
October 15, 2022 at 4:19 am #2374250DavidStaffCustomer SupportHi there,
using 2 query loops is perfectly fine way to do it.
October 29, 2022 at 10:17 pm #2393525JoyBeauty! I’ll mark as resolved. thanks heaps
October 30, 2022 at 6:07 am #2393793DavidStaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.