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

Support the default_page_template_title filter in page-attributes meta-box. #6946

Closed
kallehauge opened this issue May 24, 2018 · 0 comments · Fixed by #6948
Closed

Support the default_page_template_title filter in page-attributes meta-box. #6946

kallehauge opened this issue May 24, 2018 · 0 comments · Fixed by #6948
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Feature] Extensibility The ability to extend blocks or the editing experience

Comments

@kallehauge
Copy link
Contributor

Is your feature request related to a problem? Please describe.
It is not a given what Default template is for users of a WordPress website with themes that use multiple types of templates for layout.
So since WP version 4.1.0 there have been a filter to change the name that appears in the page-attributes meta box:

apply_filters( 'default_page_template_title', __( 'Default Template' ), 'meta-box' );
apply_filters( 'default_page_template_title', __( 'Default Template' ), 'quick-edit' );

This filter is currently not supported with Gutenberg since it is hardcoded in editor/components/page-attributes/template.js (at the time of writing it's on line 34).

Describe the solution you'd like
I would like to be able to change the name of the default template (aka when there is no value). This could either be done with the existing default_page_template_title hook or a new solution.

Describe alternatives you've considered
I have looked into how the templates are currently being fetched and this is being done with wp_get_theme()->get_page_templates() in gutenberg_editor_scripts_and_styles().
An alternative to this solution would be to wrap the call in a PHP function and set all the values inside the PHP function and use the default_page_template_title filter for the default value.

@danielbachhuber danielbachhuber added this to the WordPress 5.0 milestone May 25, 2018
@danielbachhuber danielbachhuber added [Feature] Extensibility The ability to extend blocks or the editing experience Backwards Compatibility Issues or PRs that impact backwards compatability labels May 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Feature] Extensibility The ability to extend blocks or the editing experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants