[Resolved] Disabling titles in headers for specific posts

Home Forums Support [Resolved] Disabling titles in headers for specific posts

Home Forums Support Disabling titles in headers for specific posts

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2209664
    ch1800

    Hello,

    I’m using <h1>{{post_title}}</h1> in post headers with a Header Element and would need to disable this title in some posts – not all of them.
    Would this be possible?

    I cannot make exceptions for those posts in Display Rules of this Element as this would affect all other settings as well.

    Thanks.

    #2209667
    Fernando
    Customer Support

    Hi there,

    You can try creating a duplicate of the Header Element without the <h1>{{post_title}}</h1>, and then displayed to the specific pages you prefer. Then, exclude these pages/posts in your original Header Element.

    You may also do this through CSS, you’ll just need to get to post id or page id:

    post:

    body.postid-5729 .inside-page-hero h1 {
        display:none;
    }

    if page:

    body.page-id-2621 .inside-page-hero h1 {
        display:none;
    }

    combined:

    body.page-id-2621 .inside-page-hero h1, body.postid-5729 .inside-page-hero h1 {
        display:none;
    }

    multiple:

    body.page-id-2621 .inside-page-hero h1, body.postid-5729 .inside-page-hero h1,
    body.postid-5730 .inside-page-hero h1,
    body.postid-5731 .inside-page-hero h1 {
        display:none;
    }

    As shown, you may apply the rule to multiple posts/pages, you’ll just to separate the selector with a comma.

    Here is an article with regards to adding CSS: https://docs.generatepress.com/article/adding-css/#additional-css

    Adding this through additional CSS should work.

    How to get the page/post id: https://kinsta.com/blog/wordpress-get-post-id/

    Hope this clarifies. 🙂

    #2210225
    ch1800

    Many thanks Fernando,

    I also initially thought of doing what you suggest in your first para but this looks a bit overkill.
    I finally got inspired by your CSS suggestions and ended up simply using this at each individual post separately:

    .inside-page-hero {
        display: none;
    }

    That works fine and thanks again!

    #2210865
    Fernando
    Customer Support

    You’re welcome! Glad you found a more apt solution! Feel free to reach out anytime you’ll need assistance with anything else. 🙂

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