Help test changes to template management

A recent update to the Site Editor template management system has significantly enhanced WordPress template management by providing greater flexibility and control over the template editing experience. It is now possible to view created templates separately from theme templates, store more than one template per template type (or slug), edit templates and save them without making them active, manage template revisionsRevisions The WordPress revisions system stores a record of each saved draft or published update. The revision system allows you to see what changes were made in each revision by dragging a slider (or using the Next/Previous buttons). The display indicates what has changed in each revision. more effectively, and mark specific templates as active or inactive according to requirements.

For more context on the history behind this change, read through the following proposal on GitHub

Key Changes

  • Template Management: Allows multiple templates with the same target slug and introduces the ability to switch between them by setting one as “active.”
  • Theme templates remain the “source of truth”: To edit a theme template, one first needs to create a duplicate of it as a Created Template and edit that template.
  • Theme Template Control: Users can now disable theme templates (except the essential index template)
  • New UIUI UI is an acronym for User Interface - the layout of the page the user interacts with. Think ‘how are they doing that’ and less about what they are doing.: Adds “Active templates” and “Created Templates” views in the Site Editor
  • APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. Simplification: User templates now use standard Post Type REST APIREST API The REST API is an acronym for the RESTful Application Program Interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. It is how the front end of an application (think “phone app” or “website”) can communicate with the data store (think “database” or “file system”) https://developer.wordpress.org/rest-api/. endpoints
  • Enhanced Features: Enables revisions, duplication, and trashing through normal Post actions

Benefits

  • Created templates are retained when switching themes
  • Users can disable template edits when needed
  • New templates can be created without immediately publishing
  • Templates can be added for all slugs, not just missing ones
  • Improvements to template revisions, template duplication, and deleting templates
  • And more. For full details, see the PR description

Testing Instructions

  1. Install and activate the Gutenberg Nightly plugin from GutenbergGutenberg The 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/ Times, or use this Playground link
  2. Navigate to Site Editor > Templates and test the new template management features
  3. Verify that you can see template categories for Active, Custom, and theme templates.
  4. Test custom theme templates
    1. Create, edit, and save a custom theme template, and confirm it only appears in the Created templates list.
  5. Test active templates
    1. Create multiple templates for the same target slug (ie, single-post) and ensure you can activate/deactivate different templates, and that the front-end rendering uses the correct template.
    2. Confirm that when activating one template, the other templates for that slug are marked as inactive.
    3. Test that you can activate a template in the template editing view.
  6. Test default template fallback
    1. Deactivate a theme template and ensure the correct fallback template (in line with the template hierarchy) is used instead.
  7. Test switching themes
    1. Once you’ve created a custom template, switch to a different blockBlock Block 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. theme and ensure the custom template remains.
  8. Test that template revisions, duplicating templates, and deleting templates work as expected.

Testing Steps

Breaking Changes

  • Changes to getEditedPostId and getCurrentPostId may impact plugins
  • Plugins should migrate to use getEditedPostSlug instead

Logging bugs and discussions

All existing bugs are being tracked in the following tracking issue in the Gutenberg GitHubGitHub GitHub is a website that offers online implementation of git repositories that can easily be shared, copied and modified by other developers. Public repositories are free to host, private repositories require a paid subscription. GitHub introduced the concept of the ‘pull request’ where code changes done in branches by contributors can be reviewed and discussed before being merged be the repository owner. https://github.com/ repository: https://github.com/WordPress/gutenberg/issues/71735

If you encounter any new bugs related to this feature during testing, please log them as new issues and mention them in the above tracking issue.

If you’re unsure whether what you are experiencing is a bug, you can ask in the #outreach channel on the WordPress SlackSlack Slack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/..

+make.wordpress.orgWordPress.org The community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org//coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress., +make.wordpress.org/themes

Props to @krupajnanda, @annezazu, @bph, and @juanmaguitar for assistance in reviewing this post.

#full-site-editing, #gutenberg, #needs-testing