- This topic has 7 replies, 2 voices, and was last updated 4 years ago by
Tom.
-
AuthorPosts
-
February 28, 2019 at 2:35 am #824205
tobymiguel
The way generatepress is built it requires to make 2 template files in order to make a file for a specific post.
For example if I have a page named “contact” I would need to create these two files:
page-contact.php
In page contact, I need to point it to content-page-contact.php instead of content-page.php for example.
Am I missing something here? Is there an easier way (without taking the content from content-page.php and putting it inside page-contact.php) ?
GeneratePress 2.2.2GP Premium 1.7.8February 28, 2019 at 9:19 am #824739Tom
Lead DeveloperLead DeveloperHi there,
This is so people can make small changes to content-page.php without changing page.php (for example).
If you need to make changes to both files, then it’s best to just merge the two into one custom file.
Let me know if you need more info ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 3, 2019 at 5:29 am #827223tobymiguel
Hi Tom
Is it possible to make a template for a single post where I do not need to change two files or merge them? But only create one new file
March 3, 2019 at 9:28 am #827534Tom
Lead DeveloperLead DeveloperIf you need to make changes to the code within both files, you need to change them both or merge them.
If you only need to make changes to the code in one of the files, the other one can stay untouched.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 6, 2019 at 4:54 am #830417tobymiguel
Hi Tom
I only need to change the code in one of the files, content-page.php, but for a specific page. How is that possible?
March 6, 2019 at 9:53 am #830780Tom
Lead DeveloperLead DeveloperIn that case, you would copy
content-page.php
and add it to your child theme. Then you can make whatever changes necessary.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 13, 2019 at 8:59 am #837892tobymiguel
Hi Tom
I mean, lets say I have a page called “Contact” and I want to make a specific content-page.php for the “Contact” page only.
I don’t see how this is possible with the template hierachy: https://wphierarchy.com/
Since page-$slug.php leads to page.php and not content-page.php. Is there a way to target content-page.php ?
March 13, 2019 at 4:21 pm #838231Tom
Lead DeveloperLead Developer.page.php
itself referencescontent-page.php
here: https://github.com/tomusborne/generatepress/blob/2.2.2/page.php#L31You can remove the need for
content-page.php
by copying its contents and replacing the reference to it inpage.php
with them.If you wanted a custom template for a page, you’d need to create a Page Template: https://developer.wordpress.org/themes/template-files-section/page-template-files/#creating-custom-page-templates-for-global-use
Let me know if that’s more clear or not ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.