Community Forums › Forums › Archived Forums › Design Tips and Tricks › different banners on different pages
- This topic has 29 replies, 3 voices, and was last updated 11 years, 10 months ago by Brad Dalton.
-
AuthorPosts
-
January 24, 2013 at 2:46 pm #14389fiddles5Member
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 #14393Brad DaltonParticipantUsing conditional tags with the Genesis Simple Hooks plugin.
<?php if ( !is_home() ) { ?> <div>Banner-HTML-Code-Goes-Here</div> <?php } ?>
January 24, 2013 at 3:12 pm #14394Brad DaltonParticipantThis 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 } ?>
January 24, 2013 at 3:15 pm #14395fiddles5Memberthanks, 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 #14402Brad DaltonParticipanthahaha. 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.
January 24, 2013 at 3:57 pm #14411fiddles5Memberokay -- 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 #14412fiddles5Membersorry - that's a quote mark, not ”
January 24, 2013 at 4:24 pm #14427Brad DaltonParticipantLooks fine and it doesn't display on the home page. Is this what you wanted?
January 24, 2013 at 4:29 pm #14432fiddles5MemberMaybe 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 #14434SoZoMemberYou 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 #14440Brad DaltonParticipantNo 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
January 24, 2013 at 5:01 pm #14444fiddles5MemberYes, 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 #14445SoZoMemberTo 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 #14463fiddles5Memberokay. 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 #14477SoZoMemberI 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
January 24, 2013 at 6:44 pm #14480fiddles5MemberOkay John, I'm going to try it with CSS. Here's what I tried so far that didn't work:
#header .widget-area {
float: right;
padding: 0px 0 0;
width: 262px;
margin-right:-70px;
display:none;
}.home #header .widget-area { display: visible; }
I added display:none to the #header .widget-area rule, then used the .home class as you had it in your post.
What that did was hide the widget-area on the home page. So that didn't work. What am I missing?
The body element for the home page looks like this: <body class="home blog custom-header header-image full-width-content agency">
I used the Appearance > Header to add a custom header, and changed the dimensions in the functions.php file.
http://www.portsmouthhistory.org/newdev/
help?
January 24, 2013 at 6:49 pm #14483fiddles5MemberYikes! That works for non-home pages: http://www.portsmouthhistory.org/newdev/discover-portsmouth/
But now the home page has no banner and no navigation! http://www.portsmouthhistory.org/newdev/
(I'll leave it like that for a few minutes so you can see it... thanks John!
January 24, 2013 at 6:50 pm #14484fiddles5Membersorry I should clarify John -- I'm talking about adding your supplied php to the functions.php doc, not the css issue.
January 24, 2013 at 6:53 pm #14487Brad DaltonParticipantYou could put the home page header image HTML with a conditional tag in the genesis_header Hook
<?php if (is_home() ) { ?> <div><a href="http://127.0.0.1:4001/wordpress/wp-content/uploads/2013/01/header1.png"><img src="http://127.0.0.1:4001/wordpress/wp-content/uploads/2013/01/header1.png" alt="header1.png" width="960" height="115" class="aligncenter size-full wp-image-180" /></a></div> <?php } ?>
This works as i tested it. Change the hook location if needed.
January 24, 2013 at 7:05 pm #14488fiddles5MemberThanks Brad, I did that, and you can see what happens. I get both banners on the home page, on top of eachother, and the large banner that i don't want on all the other pages. Still not working for me. http://portsmouthhistory.org/newdev/
John's latest php addition to the functions.php file didn't do it either.
But you must be on the right track as things are definitely happening with the header! Just not things I'd like to have happen! LOL!
Any other suggestions?
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.