The WordPress coreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. development team builds WordPress! Follow this site for general updates, status reports, and the occasional code debate. There’s lots of ways to contribute:
Found a bugbugA bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority.?Create a ticket in the bug tracker.
Core Editor Improvement: Deeper customization with more template options
These “CoreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. Editor Improvement…” posts (labeled with the #core-editor-improvementtagtagA directory in Subversion. WordPress uses tags to store a single snapshot of a version (3.6, 3.6.1, etc.), the common convention of tags in version control systems. (Not to be confused with post tags.)) are a series dedicated to highlighting various new features, improvements, and more from Core Editor related projects.
With the last few releases of WordPress expanding what’s possible to edit on your site, from templates to theme blocks, Gutenberg 13.7 continues this work with more templates that theme authors and end-users can create directly from the site editor. If you’ve ever wanted to have a customized experience of a categoryCategoryThe 'category' taxonomy lets you group posts / content together that share a common bond. Categories are pre-defined and broad ranging. of posts, like your recipes or latest book reviews, or to have a unique template for a special post, you’ll enjoy what’s now possible. Here are the following templates that the last few GutenbergGutenbergThe Gutenberg project is the new Editor Interface for WordPress. The editor improves the process and experience of creating new content, making writing rich content much simpler. It uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc. https://wordpress.org/gutenberg/ releases have unlocked for editing directly:
Post templates: custom post typeCustom Post TypeWordPress can hold and display many different types of content. A single item of such a content is generally called a post, although post is also a specific post type. Custom Post Types gives your site the ability to have templated posts, to simplify the concept. and post-specific templates.
Keep in mind that WordPress has supported these types of blockBlockBlock is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. templates since version 5.8 if developers manually bundled them in their themes. However, these changes allow users and extenders to create them directly from the new site editor interface. It also brings us one step closer to building more complex WordPress themes without writing code.
There are tons of use cases for these types of templates, only limited by what their creators want to build. For example, a user might want to show a grid of posts for a specific “photography” category but not change the default list style for others. A restaurant owner might remove the site’s default sidebarSidebarA sidebar in WordPress is referred to a widget-ready area used by WordPress themes to display information that is not a part of the main content. It is not always a vertical column on the side. It can be a horizontal rectangle below or above the content area, footer, header, or any where in the theme. on the “menu” page to let photos of the dishes take center stage.
To ensure third-party plugins can properly take advantage of this system too, work was done to clarify taxonomy-specific templates labels. Specifically, some custom taxonomies from third-party plugins share the same label (e.g., post categories and product categories both using the “Categories” term). In 13.7, the taxonomy slug is added in parentheses for additional clarity.
Custom Template Examples
To add custom post type or taxonomy templates, visit Appearance > Editor in the WordPress adminadmin(and super admin). Clicking the WordPress icon/button in the corner of the screen will open the sidebar panel. From there, select the Templates option.
At the top of the new page, click the “Add New” button to open the template dropdown as shown in the following screenshot:
There should be several options listed with a default WordPress install with customization options:
Single item: Post
Creating a Custom Page Template
To create a custom page template, select the “Page” option from the Templates > Add New button’s dropdown menu. A new overlay will appear on the screen for selecting a specific page to apply the template to, as shown in the following screenshot:
The overlay lists the site’s pages and a search field for quickly looking up a specific page. Creating a new template is a matter of selecting the page. WordPress then redirects to the editor for building out the template’s block content.
The Page, Post, and Custom template options are all similar in scope. However, there are some slight differences:
Page allows creating individual templates that can be applied to a specific page on the site or as the default page template (if not already defined by the theme).
Single item: Post allows users to create post-specific templates or the default template for all posts.
Custom template is for creating a custom template that can be assigned to any post, page, or custom post type.
All three types of templates essentially allow you to define a custom template for a post. The primary difference is that “page” and “single item: post” are assigned automatically to their respective page or post. However, the “custom template” is not assigned to until a post/page author selects it from the template dropdown on the post-editing screen.
These templates are often used to change the outer layout instead of the content for a specific post. For example, you could create a “custom template” that uses a Cover block for a featured-headerHeaderThe header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes. area. Then, assign it to posts or pages when you want a large banner image to stretch across the screen, as shown in the following screenshot:
There are no limits on how to design a template’s layout. Another common situation is adding or removing a sidebar for specific pages, depending on what the theme’s default is.
Creating a Custom Category Template
To create a new category template, select the “Category” option from the Templates > Add New button’s dropdown menu. The overlay will offer two choices, as shown in the following screenshot:
The first option is for creating the default category template. This is used as a fallback when a more specific category template does not exist. Selecting this option will immediately create the template and move you to the editor for customization.
The second option is for creating a custom template for an individual category. For example, perhaps you write posts about each WordCampWordCampWordCamps are casual, locally-organized conferences covering everything related to WordPress. They're one of the places where the WordPress community comes together to teach one another what they’ve learned throughout the year and share the joy. Learn more. you attend and want to have a specific template that adds some additional context when folks look at all of your WordCamp posts. Selecting this option opens a new set of choices for selecting the category, as shown in the following screenshot:
Like creating a page-specific template earlier, the process is the same. Select the category and edit the new template from the site editor.
Tag and custom taxonomy templates work the same as above for ease of use.
A Look at What’s Next
Expanding what templates can be added continues on with only a few additional use cases to cover. Beyond that overarching work, there are a few open tickets related to custom templates that folks can follow if they are keen to see how this experience will continue to improve. One such ticketticketCreated for both bug reports and feature development on the bug tracker. discusses pre-populating new templates from a fallback template within the template hierarchy. This means you would be presented with content already in the template rather than starting from scratch, greatly saving time.
Another PR focuses on improving the experience of clearing customizations when a user has customized a theme’s template. Currently, the description reads “Restore template to default state” whereas the update would offer clarification by changing it to “Use the template as supplied by the theme.”
Taken together all of these should help users and extenders alike embrace these new ways to customize your site.
The Custom template option cannot currently be assigned to specific post types. Templates created via this option are available for all posts, regardless of type. For example, the UIUIUser interface does not account for creating a template that users can assign to only pages and/or products (custom post type). This is supported via the template hierarchy, and theme authors can still manually create them.
Custom templates are also not defined in the theme.json when exporting the theme ZIP file via the site editor.
Props to @annezazu for co-writing, proofreading, and outlining the scope for this post.