WordPress / twentytwentytwo

Twenty Twenty-Two, the default WordPress theme that will launch with WordPress 5.9.
404 stars 92 forks source link

Use get_theme_file_path to load block patterns #277

Closed jffng closed 2 years ago

jffng commented 2 years ago

Description

This PR solves #221. It allows a child theme to override a pattern by including a file at the same location. This way, updates to the other patterns would still be preserved.

Testing Instructions

Ensure all the patterns still load as expected in TT2.

Bonus:

  1. Create a twentytwentytwo child theme and activate it
  2. Add a pattern with the same name (e.g. inc/pattern/footer-default.php)
  3. Change something in the pattern, go to the post editor, ensure the editor loads the child theme's version of the pattern.