[Resolved] How can I change my page title?

Home Forums Support How can I change my page title?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #973136
    Yannick

    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.

    #973170
    David
    Staff
    Customer Support

    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/

    #973173
    Yannick

    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?

    #973177
    David
    Staff
    Customer Support

    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.

    #973180
    Yannick

    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 🙂

    #973182
    David
    Staff
    Customer Support

    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.

    #973187
    Yannick

    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())?

    #973193
    David
    Staff
    Customer Support

    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.

    #973196
    Yannick

    Fair enough. Thanks for your time David!

    #973210
    David
    Staff
    Customer Support
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.