-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replicate Genesis-SB logic to display posts on the home page and archives using 3 different layouts #13
Comments
This can be done by setting the
Additionally, as with Fizzie, we can also consider eliminating the |
The following simple typo hindered my progress for a while.
Here I unintentionally added a self ending slash in the query-loop block. This was the first query block in the template part. I couldn't understand why the subsequent query blocks in the template part weren't being processed. This is what it should have been like.
Explanation
|
This is what I was actually expecting to get. When the code is wrong the subsequent query-loop blocks are not run, even though they're coded correctly. Oh, and now I've just noticed that my footer's gone back to wide width not full width! |
It was easier to handle the loop myself than to fiddle with the main query's posts. Here's an unstyled screenshot of the bottom of the thumbnail grid and the top of the links. |
Reverting to an earlier version of Gutenberg the title is correctly displayed.
|
I tracked the problem down to code changes implemented in WordPress/gutenberg#37622 Local fixBy setting But I couldn't do it easily for the post content. I don't need the post content anyway. If necessary, I could get by using the Reproducing without override logicThe problem occurs in my overriding of the
I would have thought that anyone else writing their own code to dynamically display inner blocks would experience the same problem. So far I've been unable to reproduce the problem with a standard theme like Twenty Twenty Two. |
I hadn't considered overriding the Another hacky change would be to reset the count of the number of times
|
I found the correct solution when I looked at the code for
This solution works for both the post title and the post content. |
The 3 query loops now work but the second and third use the full width of the 66% ( left hand) column. |
This solution is now delivered in v0.2.1 |
In the Genesis-SB theme the home page and certain archive pages display the result of the main query in three parts.
followed by a pagination block.
60 bigrams are displayed per page.
The logic I need to replicate includes a routine to rearrange the posts per page so that those with a Featured image come first.
This is
genesis_sb_the_posts( $posts, $query )
which is hooked intothe_posts
. It's run on every page.Note: I assume there'll be at least one featured image in a block of 60 bigrams.
Then in the loop to display the posts there's logic to check which format to use, based on the index and the number of posts which have a featured image.
genesis_sb_featured_images()
will return 0, 4, 8, 12 or 16genesis_sb_full_rows()
to determine thisgenesis_sb_hero()
,genesis_sb_images()
andgenesis_sb_after_images
are the functions being replaced by the three query blocks.Proposed solution
the_posts
filter first.gutenberg_render_block_core_query_loop()
to either fiddle with the main query's posts or handle the loop myself.The text was updated successfully, but these errors were encountered: