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

How to get current Page Template when editting a page? #9817

Closed
foreverpinetree opened this issue Sep 12, 2018 · 2 comments
Closed

How to get current Page Template when editting a page? #9817

foreverpinetree opened this issue Sep 12, 2018 · 2 comments
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.

Comments

@foreverpinetree
Copy link

I am working on making my theme to be compatible with Gutenberg. The theme has many page templates and each template has different options & layout, so I want to split them out according to the page template (After getting the page template, I will add a class to the body like page-template-{value}).

Question:
Is there a API/Hook to get the value? Or, should I use the JS: $('.editor-page-attributes__template select').val() to get it?

Regards

@tofumatt tofumatt added the [Type] Help Request Help with setup, implementation, or "How do I?" questions. label Sep 12, 2018
@foreverpinetree
Copy link
Author

Any info about this question?

OK, I used the JS to query the select value, BUT!!!!!!!!!!! This project use React tech so when the Page attributes is closed it wouldn't render the select tag. That means I have no way to get the value unless providing API or Hook. Help!!!!!!!!!!!!

@designsimply
Copy link
Member

Apologies for not being able to get to this request sooner! Some changes have happened to how Custom Editor Styles work and I have posted an explanation and example which may be helpful to you at #12874 (comment) and I would like to close this issue in favor of continuing the discussion there.

Thank you so much for your testing and asking questions about Gutenberg styling!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.
Projects
None yet
Development

No branches or pull requests

3 participants