-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compatibility issues with shortcodes in blocks and Gutenberg 18.1+ (
#517) * Move article meta logic from blocks to templates and patterns 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. * Remove debug * Use function to get post title
- Loading branch information
1 parent
c2f3275
commit 1c40953
Showing
11 changed files
with
257 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
source/wp-content/themes/wporg-developer-2023/patterns/article-meta-block-editor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Title: Article Meta for the Block Editor GitHub handbook | ||
* Slug: wporg-developer-2023/article-meta-block-editor | ||
* Inserter: no | ||
*/ | ||
|
||
?> | ||
|
||
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|40"},"margin":{"top":"var:preset|spacing|40","bottom":"var:preset|spacing|40"},"blockGap":"var:preset|spacing|20"},"border":{"top":{"color":"var:preset|color|light-grey-1","width":"1px"}}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"left","verticalAlignment":"top"},"className":"entry-meta"} --> | ||
<div class="wp-block-group entry-meta" style="border-top-color:var(--wp--preset--color--light-grey-1);border-top-width:1px;margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40);padding-top:var(--wp--preset--spacing--40)"> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700"><?php esc_html_e( 'First published', 'wporg' ); ?></p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:post-date /--> | ||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700">[last_updated]</p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:post-date {"displayType":"modified"} /--> | ||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
|
||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700"><?php esc_html_e( 'Edit article', 'wporg' ); ?></p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:paragraph {"className":"external-link"} --> | ||
<p class="external-link"><a href="[article_edit_link]"> | ||
<?php echo wp_kses_post( | ||
sprintf( | ||
/* translators: %s: article title */ | ||
__( 'Improve it on GitHub<span class="screen-reader-text">: %s</span>', 'wporg' ), | ||
'[article_title]' | ||
) | ||
); ?> | ||
</a></p> | ||
<!-- /wp:paragraph --> | ||
|
||
</div> | ||
<!-- /wp:group --> | ||
</div> | ||
<!-- /wp:group --> |
78 changes: 78 additions & 0 deletions
78
source/wp-content/themes/wporg-developer-2023/patterns/article-meta-github.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
/** | ||
* Title: Article Meta for GitHub handbooks | ||
* Slug: wporg-developer-2023/article-meta-github | ||
* Inserter: no | ||
*/ | ||
|
||
?> | ||
|
||
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|40"},"margin":{"top":"var:preset|spacing|40","bottom":"var:preset|spacing|40"},"blockGap":"var:preset|spacing|20"},"border":{"top":{"color":"var:preset|color|light-grey-1","width":"1px"}}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"left","verticalAlignment":"top"},"className":"entry-meta"} --> | ||
<div class="wp-block-group entry-meta" style="border-top-color:var(--wp--preset--color--light-grey-1);border-top-width:1px;margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40);padding-top:var(--wp--preset--spacing--40)"> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700"><?php esc_html_e( 'First published', 'wporg' ); ?></p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:post-date /--> | ||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700">[last_updated]</p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:post-date {"displayType":"modified"} /--> | ||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
|
||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700"><?php esc_html_e( 'Edit article', 'wporg' ); ?></p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:paragraph {"className":"external-link"} --> | ||
<p class="external-link"><a href="[article_edit_link]"> | ||
<?php echo wp_kses_post( | ||
sprintf( | ||
/* translators: %s: article title */ | ||
__( 'Improve it on GitHub<span class="screen-reader-text">: %s</span>', 'wporg' ), | ||
'[article_title]' | ||
) | ||
); ?> | ||
</a></p> | ||
<!-- /wp:paragraph --> | ||
|
||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
|
||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700"><?php esc_html_e( 'Changelog', 'wporg' ); ?></p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:paragraph {"className":"external-link"} --> | ||
<p class="external-link"><a href="[article_changelog_link]"> | ||
<?php echo wp_kses_post( | ||
sprintf( | ||
/* translators: %s: article title */ | ||
__( 'See list of changes<span class="screen-reader-text">: %s</span>', 'wporg' ), | ||
'[article_title]' | ||
) | ||
); ?> | ||
</a></p> | ||
<!-- /wp:paragraph --> | ||
|
||
</div> | ||
<!-- /wp:group --> | ||
|
||
</div> | ||
<!-- /wp:group --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
source/wp-content/themes/wporg-developer-2023/src/article-meta-date/block.json
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
source/wp-content/themes/wporg-developer-2023/src/article-meta-date/block.php
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
source/wp-content/themes/wporg-developer-2023/src/article-meta-date/index.js
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
source/wp-content/themes/wporg-developer-2023/templates/single-handbook-block-editor.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!-- wp:template-part {"slug":"header-alt","className":"has-display-contents"} /--> | ||
|
||
<!-- wp:template-part {"slug":"search-wide","className":"has-display-contents"} /--> | ||
|
||
<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"right":"var:preset|spacing|edge-space","left":"var:preset|spacing|edge-space"}}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group alignfull" style="padding-right:var(--wp--preset--spacing--edge-space);padding-left:var(--wp--preset--spacing--edge-space)"> | ||
|
||
<!-- wp:group {"align":"left","className":"has-three-columns","layout":{"type":"flex","flexWrap":"wrap","orientation":"vertical"}} --> | ||
<div class="wp-block-group alignleft has-three-columns"> | ||
|
||
<!-- wp:group {"tagName":"main","className":"alignwide","style":{"spacing":{"margin":{"top":"var:preset|spacing|20"}}}} --> | ||
<main class="wp-block-group alignwide" style="margin-top:var(--wp--preset--spacing--20)"> | ||
|
||
<!-- wp:group {"tagName":"article","style":{"spacing":{"margin":{"top":"0px"}}}} --> | ||
<article class="wp-block-group" style="margin-top:0px"> | ||
<!-- wp:post-title {"level":1,"style":{"spacing":{"margin":{"bottom":"40px"}}}} /--> | ||
|
||
<!-- wp:pattern {"slug":"wporg-developer-2023/article-sidebar"} /--> | ||
|
||
<!-- wp:post-content /--> | ||
|
||
<!-- wp:pattern {"slug":"wporg-developer-2023/article-meta-block-editor"} /--> | ||
|
||
<!-- wp:pattern {"slug":"wporg-developer-2023/handbook-pagination"} /--> | ||
|
||
</article> | ||
<!-- /wp:group --> | ||
|
||
</main> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:wporg/sidebar-container {"hasBackToTop":false,"inlineBreakpoint": "768px"} --> | ||
|
||
<!-- wp:wporg/chapter-list /--> | ||
|
||
<!-- /wp:wporg/sidebar-container --> | ||
|
||
</div> | ||
<!-- /wp:group --> | ||
|
||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:template-part {"slug":"footer"} /--> |
Oops, something went wrong.