-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
c2f3275
commit 4633ea5
Showing
11 changed files
with
260 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
58 changes: 58 additions & 0 deletions
58
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,58 @@ | ||
<?php | ||
/** | ||
* Title: Article Meta for the Block Editor GitHub handbook | ||
* Slug: wporg-developer-2023/article-meta-block-editor | ||
* Inserter: no | ||
*/ | ||
|
||
// get title fot the current post | ||
$title = get_the_title(); | ||
|
||
?> | ||
|
||
<!-- 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.
Oops, something went wrong.