Archived topic
After Content GP Hook - Display:none on Taxonomies?
3 replies · Started by Brian on June 22, 2019
Using the GP hook for After Content puts items in the taxonomies as well. I'm sure this is a simple php if statement, but for whatever reason I'm having a massive brain fart.
How would I get the hook not to fire (or display:none) on the taxonomies, or anywhere else besides the posts/pages.
Thanks,
Brian
Might also help to know that the hook is executing php and currently contains:
<?php the_field('benefits'); ?>
<?php if( get_field('desire') == '90%' ): ?>
<?php echo do_shortcode("[PROGRESSBAR_WP id=3897]"); ?>
<?php endif; ?>
<?php if ( function_exists( 'wpsabox_author_box' ) ) echo wpsabox_author_box(); ?>
<?php related_posts(); ?>
I *think* I have a possible solution, but I'll leave this open in case you know of a better global way to nest these statements. I know just enough PHP is completely break a site. ;)
Possible solution:
<?php if ( is_single() ) {the_field('benefits');} ?>
<?php if ( is_single() ) {if( get_field('desire') == '90%' ): ?>
<?php echo do_shortcode("[PROGRESSBAR_WP id=3897]"); ?>
<?php endif;} ?>
<?php if ( is_single() ) {if ( function_exists( 'wpsabox_author_box' ) ) echo wpsabox_author_box();} ?>
<?php if ( is_single() ) {related_posts();} ?>
// To use on single post add "if (is_single() {functionality;}
Hi there,
Maybe I'm missing something here but have you tried the Display Rules?
https://docs.generatepress.com/article/hooks-element-overview/#display-rules
You can just set it to Post > All Posts and Page > All Pages.
Let me know :)