Title: Theme Patterns
Published: 24 May 2024
Last modified: 31 July 2024

---

[Home](https://learn.wordpress.org)[Courses](https://learn.wordpress.org/courses/)
[Intermediate Theme Developer](https://learn.wordpress.org/course/intermediate-theme-developer/)
Theme Patterns

 [ Exit Course ](https://learn.wordpress.org/course/intermediate-theme-developer/)

 1.   a.  [   Global theme settings  ](https://learn.wordpress.org/lesson/global-theme-settings/)
         [Preview](https://learn.wordpress.org/lesson/global-theme-settings/)
      b.  [   Block theme styles  ](https://learn.wordpress.org/lesson/block-theme-styles/)
         [Preview](https://learn.wordpress.org/lesson/block-theme-styles/)
      c.  [   Templates  ](https://learn.wordpress.org/lesson/custom-templates/) [Preview](https://learn.wordpress.org/lesson/custom-templates/)
      d.  [   Theme Patterns  ](https://learn.wordpress.org/lesson/theme-patterns/) [Preview](https://learn.wordpress.org/lesson/theme-patterns/)
      e.  [   Style Variations  ](https://learn.wordpress.org/lesson/style-variations/)
         [Preview](https://learn.wordpress.org/lesson/style-variations/)
 2.   5 lessons
 3.   a.  [   Template overview  ](https://learn.wordpress.org/lesson/template-overview/)
         [Preview](https://learn.wordpress.org/lesson/template-overview/)
      b.  [   Template Hierarchy  ](https://learn.wordpress.org/lesson/template-hierarchy/)
         [Preview](https://learn.wordpress.org/lesson/template-hierarchy/)
      c.  [   Template parts  ](https://learn.wordpress.org/lesson/template-parts-4/) 
         [Preview](https://learn.wordpress.org/lesson/template-parts-4/)
 4.   3 lessons
 5.   a.  [   Custom functionality  ](https://learn.wordpress.org/lesson/custom-functionality/)
         [Preview](https://learn.wordpress.org/lesson/custom-functionality/)
      b.  [   Including assets  ](https://learn.wordpress.org/lesson/including-assets/)
         [Preview](https://learn.wordpress.org/lesson/including-assets/)
      c.  [   Block stylesheets  ](https://learn.wordpress.org/lesson/block-stylesheets/)
         [Preview](https://learn.wordpress.org/lesson/block-stylesheets/)
      d.  [   Block style variations  ](https://learn.wordpress.org/lesson/block-style-variations/)
         [Preview](https://learn.wordpress.org/lesson/block-style-variations/)
      e.  [   Block variations  ](https://learn.wordpress.org/lesson/block-variations/)
         [Preview](https://learn.wordpress.org/lesson/block-variations/)
 6.   5 lessons
 7.   a.  [   Introduction to Classic themes  ](https://learn.wordpress.org/lesson/introduction-to-classic-themes/)
         [Preview](https://learn.wordpress.org/lesson/introduction-to-classic-themes/)
      b.  [   The Loop  ](https://learn.wordpress.org/lesson/the-loop/) [Preview](https://learn.wordpress.org/lesson/the-loop/)
      c.  [   Theme options  ](https://learn.wordpress.org/lesson/theme-options/) [Preview](https://learn.wordpress.org/lesson/theme-options/)
      d.  [   theme.json in Classic themes  ](https://learn.wordpress.org/lesson/theme-json-in-classic-themes/)
         [Preview](https://learn.wordpress.org/lesson/theme-json-in-classic-themes/)
      e.  [   Converting a Classic theme to a Block theme  ](https://learn.wordpress.org/lesson/converting-a-classic-theme-to-a-block-theme/)
         [Preview](https://learn.wordpress.org/lesson/converting-a-classic-theme-to-a-block-theme/)
 8.   5 lessons
 9.   a.  [   Best practices for developing an accessible theme  ](https://learn.wordpress.org/lesson/best-practices-for-developing-an-accessible-theme/)
         [Preview](https://learn.wordpress.org/lesson/best-practices-for-developing-an-accessible-theme/)
      b.  [   Tools for testing theme accessibility  ](https://learn.wordpress.org/lesson/tools-for-testing-theme-accessibility/)
         [Preview](https://learn.wordpress.org/lesson/tools-for-testing-theme-accessibility/)
 10.  2 lessons
 11.  a.  [   Themes and user privacy  ](https://learn.wordpress.org/lesson/themes-and-user-privacy/)
         [Preview](https://learn.wordpress.org/lesson/themes-and-user-privacy/)
 12.  1 lesson
 13.  a.  [   Child themes  ](https://learn.wordpress.org/lesson/child-themes/) [Preview](https://learn.wordpress.org/lesson/child-themes/)
      b.  [   UI Best Practices  ](https://learn.wordpress.org/lesson/ui-best-practices/)
         [Preview](https://learn.wordpress.org/lesson/ui-best-practices/)
      c.  [   JavaScript in Themes  ](https://learn.wordpress.org/lesson/javascript-in-themes/)
         [Preview](https://learn.wordpress.org/lesson/javascript-in-themes/)
      d.  [   Build Process  ](https://learn.wordpress.org/lesson/build-process/) [Preview](https://learn.wordpress.org/lesson/build-process/)
      e.  [   Plugin API hooks  ](https://learn.wordpress.org/lesson/plugin-api-hooks/)
         [Preview](https://learn.wordpress.org/lesson/plugin-api-hooks/)
      f.  [   Testing your theme  ](https://learn.wordpress.org/lesson/testing-your-theme/)
         [Preview](https://learn.wordpress.org/lesson/testing-your-theme/)
 14.  6 lessons
 15.  a.  [   The WordPress.org Theme Directory  ](https://learn.wordpress.org/lesson/the-wordpress-org-theme-directory/)
         [Preview](https://learn.wordpress.org/lesson/the-wordpress-org-theme-directory/)
      b.  [   Required theme files  ](https://learn.wordpress.org/lesson/required-theme-files/)
         [Preview](https://learn.wordpress.org/lesson/required-theme-files/)
      c.  [   Preparing your theme for submission  ](https://learn.wordpress.org/lesson/preparing-your-theme-for-submission/)
         [Preview](https://learn.wordpress.org/lesson/preparing-your-theme-for-submission/)
      d.  [   Submitting your theme to WordPress.org  ](https://learn.wordpress.org/lesson/submitting-your-theme-to-wordpress-org/)
         [Preview](https://learn.wordpress.org/lesson/submitting-your-theme-to-wordpress-org/)
      e.  [   Updating your theme  ](https://learn.wordpress.org/lesson/updating-your-theme/)
         [Preview](https://learn.wordpress.org/lesson/updating-your-theme/)
 16.  5 lessons

### Global Settings and Styles

# Theme Patterns

Welcome to this lesson on the basics of how to create a pattern from scratch and
register patterns within your theme.

With this lesson, we will:

 * list and describe the sources of patterns available within WordPress,
 * add the Patterns property to theme.json and list the patterns to include in your
   theme from the Pattern Directory, and
 * describe the process of building a pattern from scratch in order to bundle it
   with your theme.

## Sources of patterns

What are the sources of patterns available within WordPress? When the end user uses
the inserter within a page, post or template, they will have access to patterns 
available within the currently active block theme, which includes the WordPress 
pattern directory. They will also have access to the WordPress core patterns, as
you can see in this example.

## Pattern directory

Now let’s use theme.json to list patterns from the pattern directory. Not to be 
confused with the patterns that are listed within the patterns folder. These patterns
you create yourself to add to your theme and they’re automatically registered as
long as they’re in that folder. But if we were to go into theme.json, we would see
the comma separated list of the slugs of the patterns that you find within the official
WordPress pattern directory.

## Creating patterns

Now let’s create a pattern from scratch in order to bundle it with your theme. So
again, you would create your file within the patterns folder. The file is PHP, however,
it has block markup and it also has a file header, which is essentially a comment
placed at the top of your file.

The most common metadata that you will find there is title, slug and categories.
The HTML markup code of the blocks you need can be generated within the Site Editor.
Go into the Site Editor and you can always go into the code editor in order to find
your code to copy and paste it over into your patterns PHP file.

## Next steps

As always, you can refer to the [theme handbook on WordPress.org](https://developer.wordpress.org/themes/)
and note we will cover more details for building and registering patterns in future
lessons.

 This is a preview lesson

Register or sign in to take this lesson.

 [ Take course ](https://learn.wordpress.org/course/intermediate-theme-developer/)

 [ Sign in ](https://login.wordpress.org/?redirect_to=https%3A%2F%2Flearn.wordpress.org%2Flesson%2Ftheme-patterns%2F&locale=en_US)

##  Suggestions

 Found a typo, grammar error or outdated screenshot? [Contact us](https://learn.wordpress.org/report-content-feedback/).