Archived topic
I want to hide GP Hook on specific page
7 replies · Started by Oliver on July 20, 2018
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
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; ?>
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
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
David, I removed the quotes but still not working.
The URL is the one in my original post.
hmmm... may be me having a glitch, ok with this CSS method:
.postid-785 .tve-leads-shortcode {
display: none;
}
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
Great - thats one less !important left over in the world lol
have a good one too.