Site logo

Archived topic

Change the page headline on a few pages only

3 replies · Started by David on April 22, 2019

Viewing posts 1–4 of 4

I have 5 pages that the content comes from a database via a shortcode. In these cases, I would like the on-page title to be provided from the database. I would normally create a new page template from page.php in the child theme and comment out the <h1> that was the on-page title.

When I look at your page.php that isn't so easy. I assume that you have an easy way, but that I haven't found it yet.

I am confused. In stock WP to make a page template I would:
1. copy page.php to my child theme, rename it and add the page template name as a comment. Then I could just delete the title code. Then assign the few pages I want the title deleted from to that page type.

With GP what do I have to do to get a page template like I want?

You would do that exact same thing.

The only difference is that the title function exists inside the content-page.php file, instead of page.php.

In page.php, we call that content-page.php file with this line of code: https://github.com/tomusborne/generatepress/blob/2.2.2/page.php#L31

So in your custom template, you would replace the above line with this code: https://github.com/tomusborne/generatepress/blob/2.2.2/content-page.php#L13-L63

Then you'd just remove/alter the title.

This archived topic is closed to new replies.