[Resolved] I want to hide GP Hook on specific page

Home Forums Support [Resolved] I want to hide GP Hook on specific page

Home Forums Support I want to hide GP Hook on specific page

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #628521
    Oliver

    Hi guys,

    I placed a Thrive Leads shortcode into the “After Header” hook. Basically its a info box with a text, image and a button who links to a specific post. Now this hook is shown on every page. But how can I hide this hook on that specific page I am linking too? So I don’t want to show the info box in the header. Is there a CSS hack that can do it?

    Best,
    Oliver

    GeneratePress 2.1.3
    #628539
    David
    Staff
    Customer Support

    Hi there, you can wrap you short code in a conditional – just add the page id or slug. GP 1.7 adds Display Rules to Hooks so this won’t be needed soon:

    Don’t display if page:

    <?php if ( ! is_page('ID') ) : ?>
        This content is EXCLUDED from static pages
    <?php endif; ?>

    Don’t display if post:

    <?php if ( ! is_single('ID') ) : ?>
        This content is EXCLUDED from single posts
    <?php endif; ?>
    #628551
    Oliver

    Thanks for the quick feedback, David!

    Unfortunately, my code is not working:

    <?php if ( ! is_single('785') ) : ?>
    [thrive_leads id='2881']
    <?php endif; ?>

    It still shows the info box on that post. Any idea?

    Best,
    Oliver

    #628558
    David
    Staff
    Customer Support

    Hi Oliver, can you link me directly to that post? You can edit the original post and change the URL if you want.

    EDIT before hand trying removing the ‘ quotes ‘ and just add the number

    #628582
    Oliver

    David, I removed the quotes but still not working.

    The URL is the one in my original post.

    #628584
    David
    Staff
    Customer Support

    hmmm… may be me having a glitch, ok with this CSS method:

    .postid-785 .tve-leads-shortcode {
        display: none;
    }
    #628598
    Oliver

    Yeaaa! 🙂

    That helped David, but with an !important:

    .postid-785 .tve-leads-shortcode {
        display: none !important;
    }

    Thank you, and have a nice weekend!

    Best,
    Oliver

    #628600
    David
    Staff
    Customer Support

    Great – thats one less !important left over in the world lol

    have a good one too.

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