Archived topic
Hooks on Single Page and Posts but not homepage
3 replies · Started by steven on April 19, 2018
Hey-
I'm using GeneratePress and Elementor to build my site.
I've created a page title section in Elementor and I'd like for it to display on my single pages and single posts, but not the homepage or archives.
I've tried several solutions listed in the forums, but the title keeps popping up on my homepage and I can't seem to get it to go away.
This is the code, I've worked out and placed in GP Hooks under Inside Content Container:
<?php if (is_single() || is_page()):
echo do_shortcode( '[elementor-template id="3692"]' );
else:
echo " " ;
endif;
?>
Any help at this point would be awesome!
Hi there,
Try this:
<?php if ( ! is_front_page() && ! is_archive() ) : ?>
echo do_shortcode( '[elementor-template id="3692"]' );
<?php endif; ?>
Let me know.
Close enough!
The second line was missing the opening and closing PHP tags, but I just combined into one tag and it worked like a charm:
<?php if ( ! is_front_page() && ! is_archive() ) :
echo do_shortcode( '[elementor-template id="3692"]' );
endif; ?>
Thanks for the help!
No problem :)