Archived topic
Create Basic Page Template
38 replies · Started by Darryl on October 20, 2022
Hey fellas...
With most themes there are "Edit" and "New" buttons underneath the Default Template section when creating a new page.
With GP those rather useful buttons are not available.
https://i.imgur.com/N9T9Jlh.png
How can I make on page layout templates?
Hi there,
thats not something GP would do.
Registering custom templates requires a Child Theme.
And see my reply below regarding setting up a custom template:
https://generatepress.com/forums/topic/can-not-find-template-in-pages-attributes/#post-2306945
Thanks for the reply.. and info.. will give it another good read in the morning, when my "lights" are on... curiosity question, are there any future plans to enable custom page templates using the way that I described (without necessitating child themes)... in light of the whole block editing revolution etc, etc, the child theme usage requirements seems to be more and more a limitation, rather than an advantage...
My scenario...
I simply want to define 4 page templates:
1. Donor - Bill with headline and navigation links (and default site elements)
2. Donor - Betty with headline and navigation links (and default site elements)
3. Donor - Lebron with headline and navigation links (and default site elements)
4. Recipient - Jason will headline and naviigation links (and default site elements)
All with blank content, so that I can speed up my page creation.
But there doesn't seem to be good way to do something simple. Digging under the hood to set up a child theme feels like overkill. :-/
As a traditional PHP based theme the only way to add those templates is via a Child Theme or a Plugin.
Block Based themes have a minor advantage here as they use HTML Based Templates, allowing you to save a block edited page as a template. The downside of doing so however is quite sizeable, as HTML templates don't do dynamic data like PHP templates. So you're limited to blocks or shortcodes to do more complex stuff.
The GP approach here is the Elements module.
You can use a Block Element - Content Template and in GPP 2.2 ( in beta ) you can do LoopM Templates.
This only leaves which method to select those templates.
Can you expand on this?
The GP approach here is the Elements module.
You can use a Block Element – Content Template and in GPP 2.2 ( in beta ) you can do LoopM Templates.
This only leaves which method to select those templates.
step-by-step... my caffeine IV drip appears ineffective. :-/
Hi Darryl,
Here's the reference for Block Element - Content Templates: https://docs.generatepress.com/article/block-element-content-template/
Here's the reference for Block Element - Loop Templates: https://docs.generatepress.com/article/block-element-loop-template/
The Loop template is generally made in conjunction with a GenerateBlocks Query Loop Block: https://docs.generateblocks.com/article/query-loop-overview/
Never mind the step by step... I figured it out... That "Elements Controls" filter is a giant life / time-saver..
whoops... didn't refresh before my last post... thanks for the info
You're welcome Darryl!
Now that I know how to add the navigation menus via a gp block element pages....
question:
I have some pages with content, but no nav. when I add the block element nav, it seems to remove all the content that was previously on the page.. How do I stop that behavior?
What specific Element are you referring to? Is it the Block Element - Site Header?
Block Element - Content Template
I get my error.. the top nav.. needs to be something other than content template.... what appears above the content block?
Figured it out .... Hook - Before Content
Are you adding this to a static page? The Content Template overrides the layout of the Main Query. It's generally used for Archive Pages.
What specifically are you wanting to add to your Pages - how would you like them to look like?
Yup static page.. Figured it out …. Hook – Before Content