-
Notifications
You must be signed in to change notification settings - Fork 1
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
[bw_fields] shortcode not displaying values after first query-loop post #28
Comments
Looking at the code for oik-fields I noticed that the
Note: Since this isn't a properly constructed paragraph block the Site Editor may have problems with it. |
Retesting with WordPress 6.2-RC1 and Gutenberg 15.3.1 I believe I'm getting a different problem.
The explanation is that the shortcodes block's rendering function doesn't actually expand the shortcode.
The solution is to change the shortcode block so that it actually expands the shortcodes within the query block's loop.
When the shortcode is being expanded calls to When the shortcodes are left unprocessed until the template's blocks have been rendered then the context of the current post ID returns to the main post. For Fizzie, I can override the rendering of the shortcode block using
I can't see any need for Note: This solution will not work for shortcodes which are in other blocks such as the paragraph block. |
And that probably means overriding
I hacked Gutenberg to do this and it worked. This screenshot shows:
|
Another way to override the processing for the shortcode block is to hook into the
Attempting to hook into Using this filter function is my preferred method of ensuring that shortcodes are expanded in the query loop.
|
…shortcode and paragraph blocks #28
This logic works if the template part rendering has been overridden such that tt4ai requires a different workaround to the problem. Next I saved the same set of blocks as a reusable block. |
While testing a solution for issue #27 I started changing the
home-query.html
template part.I wanted to use the
metadates.html
template part to replace the rather complicated ( and ugly ) columns block that I'd used to display Published and Last updated dates.I noticed that for the second and subsquent posts in the
query-loop
the[post-edit]
shortcode worked but the[bw_fields]
ones did not.get_edit_post_link()
callsget_post()
to find the current post ID.But the logic for
[bw_fields]
currently prevents the shortcode from doing anything when the current post is not the global post.This was done to prevent a sidebar on an archive page from displaying the wrong information.
Proposed solution
I don't want to revert the change to
[bw_fields]
.If we extend
[bw_fields]
to work when the idattribute
is '.' then this might resolve this problem.Originally posted by @bobbingwide in #27 (comment)
The text was updated successfully, but these errors were encountered: