[Resolved] How to Disable the Header that has the H1

Home Forums Support [Resolved] How to Disable the Header that has the H1

Home Forums Support How to Disable the Header that has the H1

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1129536
    Matthew

    I use an element to display my H1 on certain pages. In the element, I use {{post_title}} to display the H1. But I’ve recently changed and I want to use a shortcode to display the header (ex., [shortcode]) which will call back to a function where I can modify the header on the fly.

    The problem I’m running into is when I switch from {{post_title}} to [shortcode], GeneratePress will display my H1 a second time, and place it inside <header>. I know I could just hide that in CSS, but I’m wondering how I would get treated from like a keyword stuffing standpoint. Maybe I won’t, but I don’t know. So ideally, I want to know if there is a way to just disable the <header> content altogether from generating? At the moment, when I use {{post_title}}, nothing is in the <header> anyway.

    #1129590
    David
    Staff
    Customer Support

    Hi there,

    you can use the Layout Element to disable the Content Title:

    https://docs.generatepress.com/article/layout-element-overview/#disable-element

    #1129753
    Matthew

    I tried that but that seems to disable to top header. Not the actual <header> in the body.

    #1129761
    David
    Staff
    Customer Support

    Can you provide a link to the site so we can take a look at whats going on?
    You can edit your original topic and use the Site URL field to share the link privately.

    #1129796
    Matthew

    I added the URL so you can see but because my site is live and has over a hundred pages, I have a “display: none” on the entry-header class.

    Here is the issue again. I use an element to display my H1 inside my page-hero as such:

    <div class="tl-header">
       <h1>{{post_title}}</h1>
    </div>

    But I want to dynamically adjust the content of the title so I altered the element to use a shortcode:

    <div class="tl-header">
       <h1>[tlTitle]</h1>
    </div>

    But when I do that, GeneratePress creates a second <h1> inside the entry-header class and I effectively have two H1s… a first inside my page-hero (which is what I want) and a second inside my entry-header (which I don’t want).

    Odd part? It ONLY does this when I use a shortcode instead of using the {{post_title}}

    TLDR: I want to GeneratePress to stop putting an H1 in this section when I use a shortcode:
    <header class="entry-header"><h1 class="entry-title" itemprop="headline">xxxxxxxxxxxxxx</h1><div class="entry-meta"></div><!-- .entry-meta --></header>

    #1129823
    Matthew

    I got it fixed. I just enabled the box that says disable “Content Title” in the layout. I thought I tried that before, but I guess I didn’t. Thanks for looking into it.

    #1130388
    David
    Staff
    Customer Support

    You’re welcome

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.