get_header() swap logo on sub pages

Community Forums Forums Design Tips and Tricks get_header() swap logo on sub pages

This topic is: not resolved

This topic contains 3 replies, has 2 voices, and was last updated by  David Chu 2 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #22868



    is it possible to change the code that is called by get_header() so that I can add some logic to change the logo on post single pages.

    I’m using single.php with get_header() at the top. This pulls in a Logo file and a Menu. On these single pages I need to change the logo only but can’t find where the logo is coming from.

    my test site URL is:

    A sub page is:


    Thanks for any help.



    David Chu

    That’s an intriguing question.  I scratched my head for a bit, until I realized that the image is nowhere near the header, so your plan won’t work, unfortunately.  There’s a DIV way down at the bottom of the HTML that’s pumping that photo in there, actually below the footer.  Take a look with Firebug or the like.

    I don’t have the Stretch theme, but I can infer a couple things.  Somewhere in its admin there may be either a place for “homepage image” or the like.  Or else there could be some custom field per page that allows you to upload a giant image background.   Check those first.

    In some cases like this, if the image was being displayed as a CSS background, I would override the CSS to use another image.  Not in this case, as we have a full IMG tag.

    I can’t see inside to suggest further stuff, but that might get you on the path.  Hopefully it’s just a matter of something in my second paragraph there.  If my ideas don’t pan out, you might be in for some examination of the various functions, and maybe look for stuff that indicates sub footer or some similar nomenclature.


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers



    Hi flamenco,

    Thanks for taking a look at that for me.

    The image in a div that you refer to is my attempt at making the change.

    I opened up the header.php file and added in a PHP IF statement to echo out a different logo if it was not the home page. Here’s my header.php file. This is a copy of the header.php in genesis

    do_action( 'genesis_doctype' );
    do_action( 'genesis_title' );
    do_action( 'genesis_meta' );
    wp_head(); /** we need this for plugins **/
    <body <?php body_class(); ?>>
    do_action( 'genesis_before' );
    <div id="wrap">
    do_action( 'genesis_before_header' );
    do_action( 'genesis_header' );
     echo '<img src="images/logo.png" class="hlogo" />';
     echo '<img src="images/logo-alt.png" class="hlogo" />';
    do_action( 'genesis_after_header' );
    echo '<div id="inner">';
    genesis_structural_wrap( 'inner' );

    This problem has made me do A LOT of learning about Genesis but I’m still so confused…

    The original logo was a CSS background to the “#header #title” div

    I’m sure there is a more elegant solution out there but this is “working?” so I’ll go with this for the time being.

    Thanks again



    David Chu

    Ah!  I totally misunderstood the question.  :)   You’re speaking of the small Peter Twiss image in the header, as opposed to the big background.  I actually don’t use the CSS background for the header for various reasons, including many requests for headers that traverse the whole width instead of just the “main container wrap”.

    When I just want to stick the same image for all pages in the header, I’ll just do this, which pops it right in that title area (the following examples would just be placed in the functions.php file):

    add_action( 'genesis_site_title', 'dc_stick_logo' );
    function dc_stick_logo() {
      echo '<div id="logoSlot"><a href="/"><img src="'.CHILD_URL.'/images/CLYCD-Logo.jpg" alt="My Site\'s Title" /></a></div>';

    But if I want to put “any” image in the header, there are several ways to do that, too.  I could use a custom field, or I could leverage the Featured Image (and some additional markup may need to be added):

    add_action('genesis_site_title', 'dc_put_in_featured');
    function dc_put_in_featured() {
        if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.

    Or you could use the handy Custom Body Class on your page and do all the rest through CSS.  :-)   Before doing any of these methods, I’ll either take out (or ignore) the stock Background setting in admin.

    I hope that’s helpful. I have gotten so used to the handy Genesis hooks and filters that it’s very rare that I edit any Genesis template files anymore. But that’s a legit method, too, of course.

    Cheers, Dave

    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.