Archived topic
How can I change my page title?
9 replies · Started by Yannick on August 1, 2019
I have read many support posts and can't seem to find my answer (some solution are from 2015 and GP must have changed since then because the options are not available anymore).
All I want to do, is on my front page only, to show a different title then "Home". My page name is "Home" and I would like for it to show something different, like "Welcome to my website".
I'm pretty sure it has to do with the hooks, but I can't make it work.
Hi there,
what is stopping your from changing the Title of your Home page to "Welcome to my website"?
If you want it to say Home in the Navigation then you can edit the menu label.
Alternatively you can:
Use the Disable Elements meta box to disable the Content Title and add your own <h1>title</h1> to the page:
https://docs.generatepress.com/article/disable-elements-overview/
or create a Header Element and add the <h1>title</h1> to its content:
https://docs.generatepress.com/article/header-element-overview/
For logical reasons, I want it to be "Home" and not "Welcome to my website" in the page list. I know I can change the menu label :)
I already have a "Header Element" in place. Can I use PHP code and check if the page is the front page?
Go to Appearance > Menus where you can create your menu and assign it to the Primary ( or Secondary ) navigation - each menu item you add you can edit the Menu Label to display something different.
Header Elements have Display Rules tab - if you have one set to the Entire Site then add an Exclude Rule of the Front Page. Then create a new Header Element just for your Home and select the Front Page location in the display rules.
You guys should consider PHP code in the Header element. Duplicating my current Header element will take a while since it has a lot of specifics :)
If i need to make a duplicate of lots of posts/elements or something that is complex i will use the Duplicate Posts plugin to save time.
The Header Element already uses PHP Conditionals for its display rules. We don't allow PHP in the header element post type as it can introduce potential security risks. We ( reluctantly ) allow it in the Hooks element as it is quite a common requirement.
Then why not be able to hook into the wp_title() one available in WP and let me change it based on the current page (is_front_page())?
There is nothing stopping you from writing your own conditional filter to change the title in your child theme functions.php. As the Header Element is a Post Type, it is not the place for adding PHP code - and to be honest sounds really complicated to change the title of a single page.
Fair enough. Thanks for your time David!
You're welcome