Dynamic Headers, Multiple Headers

Community Forums Forums General Discussion Dynamic Headers, Multiple Headers

This topic is: not resolved

Tagged: 

This topic contains 4 replies, has 2 voices, and was last updated by  markr 1 year ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #34653

    markr
    Participant
    Post count: 2

    Struggling on this one for some reason. Would like to attach alternative header graphics to various Pages and Post Categories. Starting with this addition to stylesheet, but do not think it is correct, because there is no change from the default full-width image header graphic.


    .page-id-544 .header-full-width #title-area,
    .page-id-544 .header-full-width #title,
    .page-id-544 .header-full-width #title a {
    background: url(/images/header-offroad-v1.png) no-repeat transparent;
    }

    Am I barking entirely up the wrong tree here? Must the tag also be specifically modified somewhere as well? Thanks in advance for a shove in the right direction.

    #34669

    braddalton
    Participant
    Post count: 7447
    #34671

    markr
    Participant
    Post count: 2

    Thanks for weighing in, Brad. I tried adding this to my functions.php in the child theme:

    /** Added by MR for custom body classes to facilitate multiple headers */
    add_filter( 'body_class', 'add_body_class' );
    function add_body_class( $classes ) {
    if ( is_page( '544' ))
    $classes[] = 'page-id-544';
    return $classes;
    }

    and this into the stylesheet:

    .page-id-544 .header-full-width #title-area,
    .page-id-544 .header-full-width #title,
    .page-id-544 .header-full-width #title a {
    background: url(/resources/images/header-offroad-full-v1.png) no-repeat transparent;
    }

    Somewhere I must be making wrong assumptions about how a CSS works with Genesis.

    #34672

    braddalton
    Participant
    Post count: 7447

    That code won’t work.

    You can use CSS or PHP to add different images to different pages, posts and categories.


    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

    #34679

    markr
    Participant
    Post count: 2

    No, it surely did not work. But I don’t know why and wish I did. Am I not adding a class to a page and then in the style sheet specifying a background for that class? Where did I go wrong? And thanks!

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

You must be logged in to reply to this topic.