-
Notifications
You must be signed in to change notification settings - Fork 28
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
Fix compatibility issues with shortcodes in blocks and Gutenberg 18.1+ #517
Conversation
After WordPress/gutenberg#60349, shortcodes passed via block attributes don't work. Shortcodes in block markup in patterns do work, so stop using custom blocks and move the logic to the template level instead.
// The block editor handbook doesn't have a changelog. | ||
// We only know it's the changelog because of the linkURL attribute. | ||
if ( 'blocks-handbook' === $post_type && '[article_changelog_link]' === $block['attrs']['linkURL'] ) { | ||
return ''; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic replaced by the switch here
$local_handbooks = array( 'apis-handbook', 'plugin-handbook', 'theme-handbook' ); | ||
$post_type = get_post_type(); | ||
|
||
if ( in_array( $post_type, $local_handbooks ) ) { | ||
return ''; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic replaced by reverting the removal of the single-handbook-github.html
template
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Links & dates all work, checked a few different handbook pages. I left two comments, but this shouldn't need a re-review to merge 👍🏻
The result is a fair bit of markup duplication but the reduction of custom block usage and hidden complexity is probably positive.
Yeah, it's too bad about the duplication, but this is probably closer to how core expects themes to behave, so hopefully less likely to break 🤞🏻
Fixes #513
After WordPress/gutenberg#60349, shortcodes passed via block attributes don't work.
Shortcodes in block markup in patterns do work, so this PR removes the custom block usage and puts the shortcodes directly in the pattern markup. The main reason for using these custom blocks was conditional rendering, which has been moved to the template level.
The result is a fair bit of markup duplication but the reduction of custom block usage and hidden complexity is probably positive.
Testing