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

UI: Add Page Templates #991

Closed
jasmussen opened this issue Jun 2, 2017 · 26 comments
Closed

UI: Add Page Templates #991

jasmussen opened this issue Jun 2, 2017 · 26 comments
Assignees
Labels
Core REST API Task Task for Core REST API efforts Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts

Comments

@jasmussen
Copy link
Contributor

When you use the editor to edit a page, you need to be able to pick a template, set the order, and parent.

Those three properties are very likely to change in the future. But they are nonetheless important to be able to set in a transitional period.

What's the best way to approach this?

Here's a quick mockup of a transitional metabox that would be good to retire once something superior can replace it:

screen shot 2017-06-02 at 09 44 37

post settings

@jasmussen jasmussen added Design Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Type] Question Questions about the design or development of the editor. labels Jun 2, 2017
@paulwilde
Copy link
Contributor

paulwilde commented Jun 2, 2017

The Order field should be a [type="number"] input instead of a dropdown, by the way. Drop-down doesn't really make sense for numerical values, as you could be thousands of options.

@jasmussen
Copy link
Contributor Author

The Order field should be a [type="number"] input instead of a dropdown, by the way. Drop-down doesn't really make sense for numerical values, as you could be thousands of options.

That was bad mockup copy/pasta on my part, sorry :) I meant for it to be a plain input field, but type="number" is even better.

@afercia
Copy link
Contributor

afercia commented Jun 2, 2017

Hm I'm not sure about the [type="number"] while technically it would be appropriate, we're discussing them in the accessibility team since it seems it's not widely supported by assistive technologies 😞 More details here: https://make.wordpress.org/accessibility/2017/02/13/testing-html5-type-attributes-in-forms-with-different-browsers-and-at/

[type="number"] seems problematic especially with speech recognition software (Dragon), more details here: https://make.wordpress.org/accessibility/2017/01/16/testing-form-functionality-with-different-assistive-technology/

@jasmussen jasmussen added this to the Beta milestone Jun 5, 2017
@aduth aduth self-assigned this Jun 12, 2017
@aduth
Copy link
Member

aduth commented Jun 12, 2017

we're discussing them in the accessibility team since it seems it's not widely supported by assistive technologies 😞 More details here: https://make.wordpress.org/accessibility/2017/02/13/testing-html5-type-attributes-in-forms-with-different-browsers-and-at/

My takeaways from this post are: validation isn't always reliable (maybe not a blocker?), shows a small input by default (could be resolved by styling or size attribute?). Anything I overlooked?

[type="number"] seems problematic especially with speech recognition software (Dragon), more details here: https://make.wordpress.org/accessibility/2017/01/16/testing-form-functionality-with-different-assistive-technology/

That's a shame. If this becomes a blocker, maybe it could be enough to recreate the effect with a text type, numeric pattern attribute, and manually bind to the keyboard events to simulate increment effects?

@mtias mtias modified the milestones: Beta 2, Beta Jun 15, 2017
@mtias mtias changed the title UI: Consider Page Templates UI: Add Page Templates Jun 22, 2017
@mtias
Copy link
Member

mtias commented Jun 22, 2017

This is something that needs to be added. For v2 we'll rethink how you select templates, maybe with an upfront selection process like when creating a new slide in keynote or pages document.

@mtias mtias removed this from the Beta 2 milestone Jun 22, 2017
@mtias mtias removed the [Type] Question Questions about the design or development of the editor. label Jun 26, 2017
@mtias mtias added this to the Beta 3 milestone Jun 26, 2017
@westonruter
Copy link
Member

I'd like to see, probably in v2, page templates that specify the blocks that they allow, their order, how many of each type, and so on. When they do these blocks then get added to the editor as locked. This could be added to the page template metadata PHP docblock comment.

@jasmussen
Copy link
Contributor Author

that specify the blocks that they allow

See also #1654

@mtias mtias modified the milestones: Beta 0.5.0, Beta 0.4.0, Beta 0.7.0 Jul 6, 2017
@aduth aduth added the Core REST API Task Task for Core REST API efforts label Jul 12, 2017
@aduth
Copy link
Member

aduth commented Jul 12, 2017

Added "Needs API Endpoint" label. To my knowledge, there's currently no way to retrieve available page templates from the REST API.

@westonruter
Copy link
Member

westonruter commented Jul 12, 2017

Something else to note is that the list of available page templates can actually vary from page to page, due to the theme_{$post_type}_templates filter. So the endpoint would need to hang off of the page resource itself, like: /wp-json/wp/v2/pages/:id/available-templates

@westonruter
Copy link
Member

@aduth I've started a PR (#2086) to add a new available_page_templates field to the page resource which we can use to obtain the available templates and their names for use in a page template selector.

@mtias mtias removed this from the Beta 1.2 milestone Sep 6, 2017
@youknowriad
Copy link
Contributor

This is important to have, let's try to work on this soon.

@karmatosed karmatosed modified the milestones: Needs API, 2.0.0 Dec 18, 2017
@redsoxfan2499
Copy link

redsoxfan2499 commented Dec 25, 2017

Just wondering about the status of including page templates. I just downloaded the recent version and there is no where to choose a page template. I like idea of adding certain blocks based on a CPT but there are plenty of times where there is NO CPT created but I still need to use a custom template. So just checking on the status of how and when the ability to choose a custom template from the Gutenberg editor.

screen shot 2017-12-25 at 6 21 05 am

@brothman01
Copy link

I would like to see this functionality too!

@aduth
Copy link
Member

aduth commented Aug 20, 2018

@brothman01 This feature has since been implemented, so it should be available for you to use. If you're not seeing the option, can you verify that you're editing a page? Can you provide more information about the theme you're using, and which page templates you're expecting to see?

@redsoxfan2499
Copy link

aduth, thanks for the information. Yes it is showing up now.

Thanks!

@gmariani
Copy link

gmariani commented Sep 5, 2018

Still not seeing it, running Gutenberg 3.7 on WordPress 4.9.8

@ajvillegas
Copy link

@gmariani Make sure that your theme is loading at least one page template, because if your theme is not, then it won't show up.

@jcklpe
Copy link

jcklpe commented Sep 29, 2018

@ajvillegas I am also not able to see any page template selectors, and I'm pretty sure that my theme is loading up a template. I'm just using a modified version of twentyseventeen.

@ChazzLayne
Copy link

I'm not seeing it either, and I KNOW there are page templates on the site/theme I'm editing. The site and theme in question have not changed in any way other than the update to WP5, so clearly this is a WP5/Gutenberg issue.

(And FWIW, I actually love Gutenberg, can't wait for it to be perfect.)

@aduth
Copy link
Member

aduth commented Jan 2, 2019

@jcklpe @ChazzLayne If possible, could you provide a set of steps that someone could follow to reproduce the issue? Particularly considering whether there's a specific (publicly-available) theme / post type combination under which valid templates are not appearing.

It may be worth providing these as part of a new issue targeted at missing templates, rather than continuing the discussion here, since it will be more visible / actionable that way.

@stellalabella
Copy link

stellalabella commented Jan 17, 2019

WordPress 5.0.3 running Twenty Nineteen theme. No template options in Add New Page. :(

@aduth
Copy link
Member

aduth commented Jan 21, 2019

@stellalabella The Twentynineteen theme does not include any custom page templates, which is the likely explanation for them not being shown in the editor. The same can be seen in the classic editor using the Classic Editor plugin.

@jultra
Copy link

jultra commented Feb 28, 2019

Update! I installed Sela theme which is known to have page templates, and it worked.

I have installed Wordpress 5.1. Template option is not available in Add new page also. I tried several themes just in case, and yet, none one of them got their template option displayed in the edit page. Only the parent page and order options were available.

@themedleb
Copy link

themedleb commented Mar 22, 2020

Same here, no "Page Template" option under "Page Attributes", and I'm sure that I have a template file in my theme folder like "templatename.php".
Has this content:

/*
Template Name: templatename
Template Post Type: page
*/

Oh and the WordPress version is 5.3.2

That's weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core REST API Task Task for Core REST API efforts Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts
Projects
None yet
Development

No branches or pull requests