Archived topic
Make banner show up on the blog and single post with sections active.
3 replies · Started by Terrell Jerry on September 22, 2018
Is this the code for stopping banners for showing up on the homepage?
add_action( ‘generate_before_main_content’,’tu_blog_banner’ );
function tu_blog_banner() {
if ( is_home() || is_single() ) {
?>
<script data-oio-zone=”type=banner&zone=2&align=center&refresh=0″>
(function(w,d,e,o,u,s,t){w[o]||(w[o]={},s=d.createElement(e),s.src=u,s.async=1,
t=d.getElementsByTagName(e)[0],t.parentNode.insertBefore(s,t))})(window,document,
“script”,”oiopub”,”http://www.nthqmockup.com/wp-content/plugins/oiopub-direct/zones.js");
</script>
<?php
}
}
Hi there,
Have you considered using the new Hooks element?: https://docs.generatepress.com/article/hooks-element-overview/
It allows you to set the display rules without having to write PHP.
Let me know :)
Tom,
It works thanks for the good info. Have a good one Tom!
Thanks, you too! :)