Skip to content
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

Update Pattern Registration flow in theme to use patterns directory #113

Merged
merged 2 commits into from
May 25, 2022

Conversation

fabiankaegy
Copy link
Member

Description of the Change

WordPress 6.0 introduces the ability to register patterns via the patterns/ directory at the root of the theme. This mechanism makes it much simpler to manage patterns and therefore is what I would recommend going forward.

The Dev Note is not jet published but you can view the draft here: WordPress/gutenberg#39654 (comment)

Closes #100

Alternate Designs

Possible Drawbacks

Verification Process

  • Add a new PHP file in the patterns/ directory of the theme.
  • Add the metadata comment at the top of the file and the block pattern markup underneath.
<?php
/**
 * Title: Example Pattern
 * Slug: tenup-theme/example
 * Categories: 10up-theme
 *
 * @package TenUpTheme
 */

?>
<!-- wp:heading -->
<h2>Example Pattern</h2>
<!-- /wp:heading -->
  • Open the editor and view that the pattern shows up in the pattern picker

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

Changed how patterns are being registered to align with the API introduced in WordPress 6.0

Credits

Props @

@fabiankaegy fabiankaegy added the enhancement New feature or request label Apr 27, 2022
@fabiankaegy fabiankaegy added this to the WordPress 6.0 milestone Apr 27, 2022
@fabiankaegy fabiankaegy self-assigned this Apr 27, 2022
Copy link
Contributor

@joesnellpdx joesnellpdx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabiankaegy

I approve - but let's be sure to have this update in the GB site and in your next post update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Align Pattern registration flow with new API's in WordPress 6.0
2 participants