Archived topic
Banner 728x90 not showing on certain pages.
33 replies · Started by Terrell Jerry on May 26, 2017
Hello Thomas,
How do I get the banner to how up on the blog while using sections. I have the code to make the sidebar show up while using sections but I need a code for the 728x90 banner to show up in the inside content container and I don't want it to show up on the home page.
I look forward to your response.
thanks,
Jerry
Hi Jerry,
There are several GP hooks you might be able to use depending on where you want the banner:
http://demo.generatepress.com/hook-locations/
https://docs.generatepress.com/article/hooks-overview/
Then use conditional tag to make it show up on that page only:
https://codex.wordpress.org/Conditional_Tags#The_Main_Page
Let me know if you need more info :)
Hello Leo,
I would like the banner to show up on the blog while using sections. I already have the code for it not to show up on the homepage but I want it to show on the blog and single post inside content container.
thanks,
Jerry
Have you tried the inside content container hook shown above?
How are you displaying blog using section currently? Can you link me to the page?
Everything is in the draft and private mode the site isn't live yet but will be real soon. Just trying to make sure my banners are in place to collect emails.
Yes, I'll be using sections for the blog page to display all blog post.
I currently have this code in the inside content container hook.
thanks,
Jerry
Sorry code :
<?php if ( ! is_front_page() ) : ?><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://zippsurge.com/wp-content/plugins/oiopub-direct/zones.js");
</script><?php endif; ?>
The sections add-on actually won't work for the blog page: https://generatepress.com/forums/topic/sections-in-posts-page/
So are you saying that my blog post summary will not show with sections activated.
You won't be able to activate Sections the main blog page.
WordPress ignores all metaboxes on blog/archive and other index pages by default.
An alternative is to use Tom's WP Show Posts: https://wpshowposts.com/
Then you can insert shortcode in Sections.
Okay, I understand that. What I'm trying to make my banner 728x90 show up on the blog and when you click the blog post. Will the banner show up while using sections on the blog tab.
I show you an example below.
See how John 728x90 banner shows up without the blog text image showing up. When you use sections on the blog page that blog text dosen't show.
It looks like he created a blue banner with the white text Blog. But in wordpress that text shows up twice when I have a banner like John.
When I activate sections that secound blog text goes away.
thanks,
Jerry
Sounds like you need two conditionals - one for the main blog page and one for single posts:
https://codex.wordpress.org/Conditional_Tags#The_Main_Page
https://codex.wordpress.org/Conditional_Tags#A_Single_Post_Page
When Sections is activated, the layout of the page is wiped clean as it acts like a page builder.
If you can put your site up on a temporary server it would be much easier for me to see whats' going on :)
I can add you as a user if that would work Leo.
Have you tried this?:
add_action( 'generate_before_main_content','tu_blog_banner' );
function tu_blog_banner() {
if ( is_home() || is_single() ) {
?>
Your banner in here
<?php
}
}
Do I put this as snippet then activate it or where do it go.
Yup Code Snippets: https://docs.generatepress.com/article/adding-php/#code-snippets