Community Forums › Forums › Design Tips and Tricks › different banners on different pages
This topic contains 29 replies, has 3 voices, and was last updated by braddalton 3 months, 3 weeks ago.
-
AuthorPosts
-
January 24, 2013 at 2:46 pm #14389
Hi — I’d like to have one banner on the home page, using the widgeted area in the header-right for ads, and a different shorter banner in height, but with no ads on the right — the banner would be across the entire top of the page on ALL of the site’s other pages. Using the Agency Theme – Here is the dev site: http://portsmouthhistory.org/newdev/
How can I do this?
Thanks!
January 24, 2013 at 3:03 pm #14393Using conditional tags with the Genesis Simple Hooks plugin.
<?php if ( !is_home() ) { ?> <div>Banner-HTML-Code-Goes-Here</div> <?php } ?>
WordPress Developer & Consultant
Brad Dalton @ WP Sites – Click Here to Get Genesis Child Theme Tips Delivered.January 24, 2013 at 3:12 pm #14394This is exactly what i used on my local system. I uploaded the image using the exact width from the header with align centre.
Pasted this code in this hook location.
genesis_before_header Hook
<?php if ( !is_home() ) { ?> <div><a href="http://127.0.0.1:4001/wordpress/?attachment_id=178" rel="attachment wp-att-178"><img class="aligncenter size-full wp-image-178" alt="banner" src="http://127.0.0.1:4001/wordpress/wp-content/uploads/2013/01/banner.png" width="960" height="115" /></a></div> <?php } ?>
WordPress Developer & Consultant
Brad Dalton @ WP Sites – Click Here to Get Genesis Child Theme Tips Delivered.January 24, 2013 at 3:15 pm #14395thanks, Brad — but I’m using the header-right widgeted area only on the home page. I don’t see how the “Banner-html-code-goes-here” would support that only on the home page and not on the other pages ?
I’d also need the banner area for all of the other pages to be half the height of the home page banner. Is that an easy fix?
thanks again! I am not really that familiar with php – probably know just enough to be dangerous…
January 24, 2013 at 3:22 pm #14402hahaha. Sorry didn’t answer your question on the widget.
This is only for the banner to display on all pages excluding the home page.
‘I’d also need the banner area for all of the other pages to be half the height of the home page banner. Is that an easy fix?’
Yes. Make the banner half the height.
Try this first please and then we’ll hit the widget.
WordPress Developer & Consultant
Brad Dalton @ WP Sites – Click Here to Get Genesis Child Theme Tips Delivered.January 24, 2013 at 3:57 pm #14411okay — look at this page for the result I got with the code I used: http://www.portsmouthhistory.org/newdev/discover-portsmouth/
Here is the code I used: <?php if ( !is_home() ) { ?>
<div><img src=”http://www.portsmouthhistory.org/newdev/wp-content/themes/agency/images/bannerhalf.png” /></div>
<?php } ?>and checkmarked execute php on this hook.
This in the Genesis before header hook – or should it be put in genesis header hook? and then what to checkmark?
January 24, 2013 at 3:59 pm #14412sorry – that’s a quote mark, not ”
January 24, 2013 at 4:24 pm #14427Looks fine and it doesn’t display on the home page. Is this what you wanted?
WordPress Developer & Consultant
Brad Dalton @ WP Sites – Click Here to Get Genesis Child Theme Tips Delivered.January 24, 2013 at 4:29 pm #14432Maybe you aren’t seeing the same thing I see? It works, sort of, but I see 2 banners — one on top of the other — on all the pages except the home page. So I see the shorter banner, and then right below it the home page banner with the rotating ads on the right. So no, this isn’t what I wanted. I see 2 banners in Firefox and in Safari so it doesn’t appear to be a browser issue. So there must be some extra php to hide the header on the other pages?
I so appreciate your help with this!
January 24, 2013 at 4:37 pm #14434You could do it all with css. Set the header default rules to what you want the interior pages to have. i.e. the height, background etc. and add “display: none;” to #header .widget-area then use the .home body class to create separate rules to target the div on the home page, i.e.
.home #header .widget-area { display: visible; }
I would increase the height of #title-area a so that the link covers your entire header image as well.
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 24, 2013 at 4:54 pm #14440No problem. Firstly i wanted to see if you are happy with the position of the smaller banner.
Now we Just need to remove the larger header from all pages except the home page right?
Or you can take Johns suggestion and use CSS
WordPress Developer & Consultant
Brad Dalton @ WP Sites – Click Here to Get Genesis Child Theme Tips Delivered.January 24, 2013 at 5:01 pm #14444Yes, Brad — I’d like to try your suggestion, and save John’s for another time, thank you! And thank you John! I see what you mean.
So yes, let’s remove the larger header from all the pages except the home page!
January 24, 2013 at 5:02 pm #14445To remove the header on every page but the home page add this to functions.php
add_action(get_header, remove_header);
function remove_header() {
if( ! is_home())
remove_action( ‘genesis_header’, ‘genesis_do_header’ );
}I would make the interior image a link back to the home page as well.
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 24, 2013 at 5:45 pm #14463okay. added that to the bottom of functions.php but it didn’t do anything. http://www.portsmouthhistory.org/newdev/discover-portsmouth/
Any suggestions?
January 24, 2013 at 6:36 pm #14477I think the issue is the single quotes end up fancy in the forum so write it out instead of copy pasting and use this instead
add_action(get_header, remove_header); function remove_header() { if( ! is_home()) remove_action( 'genesis_header', 'genesis_header_markup_open', 5 ); remove_action( 'genesis_header', 'genesis_do_header' ); remove_action( 'genesis_header', 'genesis_header_markup_close', 15 ); }
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
-
AuthorPosts
You must be logged in to reply to this topic.