different banners on different pages

Community Forums Forums Design Tips and Tricks different banners on different pages

This topic is: not resolved

Tagged: , ,

This topic contains 29 replies, has 3 voices, and was last updated by  braddalton 1 year, 9 months ago.

Viewing 15 posts - 1 through 15 (of 30 total)
  • Author
    Posts
  • #14389

    fiddles5
    Participant
    Post count: 26

    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!

     

     

    #14393

    braddalton
    Participant
    Post count: 10217

    Using conditional tags with the Genesis Simple Hooks plugin.

    [php]
    <?php if ( !is_home() ) { ?>
    <div>Banner-HTML-Code-Goes-Here</div>
    <?php } ?>
    [/php]


    #14394

    braddalton
    Participant
    Post count: 10217

    This 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]
    <?php if ( !is_home() ) { ?>
    <div><a href="http://127.0.0.1:4001/wordpress/?attachment_id=178&quot; 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&quot; width="960" height="115" /></a></div>
    <?php } ?>
    [/php]


    #14395

    fiddles5
    Participant
    Post count: 26

    thanks, 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…

     

    #14402

    braddalton
    Participant
    Post count: 10217

    hahaha. 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.


    #14411

    fiddles5
    Participant
    Post count: 26

    okay — 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?

     

    #14412

    fiddles5
    Participant
    Post count: 26

    sorry – that’s a quote mark, not ”

    #14427

    braddalton
    Participant
    Post count: 10217

    Looks fine and it doesn’t display on the home page. Is this what you wanted?


    #14432

    fiddles5
    Participant
    Post count: 26

    Maybe 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!

    #14434

    SoZo
    Moderator
    Post count: 1573

    You 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

    #14440

    braddalton
    Participant
    Post count: 10217

    No 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


    #14444

    fiddles5
    Participant
    Post count: 26

    Yes, 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!

    #14445

    SoZo
    Moderator
    Post count: 1573

    To 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

    #14463

    fiddles5
    Participant
    Post count: 26

    okay. added that to the bottom of functions.php but it didn’t do anything.  http://www.portsmouthhistory.org/newdev/discover-portsmouth/

     

    Any suggestions?

    #14477

    SoZo
    Moderator
    Post count: 1573

    I 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
    [php]
    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 );
    }
    [/php]


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

Viewing 15 posts - 1 through 15 (of 30 total)

You must be logged in to reply to this topic.