Archived topic
Create Basic Page Template
38 replies · Started by Darryl on October 20, 2022
I see. Let us know if you'll need assistance with anything else.
After several hours.. just realized the entire Block Element approach to placing my navigation pages won't work...

While the primary and secondary navs are consistent across x pages... the left hand Headline and middle "text" changes on certain pages.. and if I change the block in one place it changes everywhere...
so I'm still better off either trying to set up a child theme.. or just manually adding a nav block on every page I create, which creates an extra step when I am trying to focus on content.
Any suggestions?
You'll need to use a GenerateBlocks Headline Block. Then, enable Dynamic data.
Reference: https://docs.generateblocks.com/article/headline-overview/#dynamic-data
You should be able to dynamically retrieve meta data unique to posts through that. Example for title: https://share.getcloudapp.com/6quG1rqZ
Ok.. thanks for that... that solved the Title part of my problem... but what about the middle "text" section illustrated as a place holder... I may want that to be blocks containing images, text, etc...
How do I handle that ?
So I created a custom page and the gp CHILD theme is active:
$ ls generatepress_child/
content-custom-page.php css custom-page.php functions.php functions.php~ js screenshot.png style.css
$ cat generatepress_child/content-custom-page.php
<?php
/**
* Template Name: Page template
* Template Post Type: page
* @package GeneratePress
*/
So now... How do I select the custom page so that I edit and make new pages?

There isn't an option for the template in the menu
Realized my idiotic nature... created child theme in wrong terminal window (wrong server) ignore the last post
Ok ... I got the page templates to be available correctly...
What I don't understand is how do I get my various nav blocks to appear by default for each relative template, without running into the same problem, I faced above using the Block Element.

If you're using a Content Template on a static page, you can use a Dynamic Content Block. Reference: https://docs.generatepress.com/article/dynamic-blocks/#dynamic-content
This Block can pull the unique content of each page.
With the "Nav Blocks", are your referring to the default Header or the WP Navigation Block?
thanks for trying, but the content types within the dynamic blocks are far too limited...
I am thinking of images with popover content, maybe guided tour js script...
When I say "Nav Block" I am referring to the Headline, primary nav, "text" block, and secondary nav menu that I created inside of one grid and added to reusuable blocks..

At this point, I am starting think that I am better off just manually adding the my block for each page I create... unless you can tell me how to my block to appear by default on a custom template page that I created (screenshot above)..
.... appearing in such a way that I am still able to edit it as necessary on some pages... which is what I can't do with the block element
In general, these are the two template files used for the Page Template by default:
https://github.com/tomusborne/generatepress/blob/adfe090929b0515cdf894f4c6b722cfe8c0790dc/page.php
https://github.com/tomusborne/generatepress/blob/master/content-page.php
You'll see that there's GP hooks in these files.
If you're creating a custom Template, it would be best to include the Hooks so you can use them in your Elements.
The default header works with the get_header(); line. the header.php file also includes hooks. You'll need this line or the hooks in this file to assure that the Nav will work in your custom templates.
Ok... my child theme experiments have not been going well. I don't have a lot of time to keep troubleshooting... so in order to save a full-day's progress, I need to re-visit the dynamic content blocks that you told me about previously.
I was quick with my assessment, maybe I made too much of an assumption.
Most guided tour scripts an href link on an element such as an image or text.
Question 1:
If I used a dynamic image block with a featured image that had an href link possibly containing "rel" or other attributes do you possibly foresee any problem with the script launching?
Question 2:
If I use a dynamic content block, can I somehow specify the exact content to be display using tags of some sort (I assume). And can that content itself contain links?
Seems my initial reactions to the gp dynamic blocks were correct
Question 1: no links can be added to the featured image, so that kills any thought of a pop-over or tour link
Question 2: I can't control / specify what body content gets used in the block, its just grabbing the first 55 words.. while it does accept links... it doesn't accept body content images thereby killing any notion of popvers or guided tours again...
At this point I am better off cutting my losses on the issue and just manually add my navs on every page... :-/
I am not sure what it is you want to achieve, but it sounds like a re-invention of the wheel.
For example:
At this point I am better off cutting my losses on the issue and just manually add my navs on every page… :-/
Are you wanting a different Navigation on every page ?