Different Headers on Pages

Community Forums Forums Design Tips and Tricks Different Headers on Pages

This topic is: not resolved

Tagged: 

This topic contains 12 replies, has 4 voices, and was last updated by  derekalvarez 8 months, 2 weeks ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #69519

    virtual
    Participant
    Post count: 6

    Is there a way to change the header for specific pages?

    http://hg.virtuallyassistingu.com/
    #69526

    emasai
    Participant
    Post count: 648

    Try this from Brad Dalton
    http://wpsites.net/web-design/using-different-headers-on-different-pages-of-the-genesis-2-0-sample-theme/


    Need Website Customization or a Responsive CSS fix? Contact Me
    Lynne emasai.com

    #69552

    virtual
    Participant
    Post count: 6

    This is great info. Thanks so much. I should be able to get it done for specific pages.

    #78865

    derekalvarez
    Participant
    Post count: 47

    What if I want to change the header for all pages that have /idx/ as the parent?

    Would this be possible by creating a custom page template? If so, can you point me to a tutorial talking about how to do this?

    #78909

    braddalton
    Participant
    Post count: 9415

    If you want the same header in all pages using the template you could hard code it into the template otherwise you can use conditional tags to display it on specific templates.

    Another option is to use a plugin like WP Display Header

    Or this http://wordpress.org/plugins/custom-header-extended/


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #78918

    derekalvarez
    Participant
    Post count: 47

    Thanks, Brad!

    I think hardcoding it into the template would be best because we’re using an IDX that automatically generates pages and then I can make those use my template.

    Is there a tutorial on changing headers by using a custom template you can point me to?

    #79116

    derekalvarez
    Participant
    Post count: 47

    Hi Brad, I created a template called “Real Estate Home Page”. I used this code to remove the header, breadcrumbs, and footer…

    <?php
    /**
     * This file adds the Real Estate Home Page template to the News Child Theme.
     *
     * @author Derek Alvarez
     * @package News
     * @subpackage Customizations
     */
    
    /*
    Template Name: Real Estate Home Page
    */
    
    // Remove header, breadcrumbs, footer widgets 
    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 );remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs');
    remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );
    
    genesis();

    Can you help me with the code to add a different header?

    Url is…
    http://cortezcolorado.net/real-estate/mockup/

    #79127

    derekalvarez
    Participant
    Post count: 47

    I’m screwing up somehow. I created a file called, “real_estate_header.php” with this code and added it to my child theme…

    <?php
    /**
     * Real Estate Header
     *
     * @package Custom Header
     * @author  Derek Alvarez
     */
    
    do_action( 'genesis_doctype' );
    do_action( 'genesis_title' );
    do_action( 'genesis_meta' );
    
    wp_head(); //* we need this for plugins
    ?>
    </head>
    <?php
    genesis_markup( array(
    	'html5'   => '<body %s>',
    	'xhtml'   => sprintf( '<body class="%s">', implode( ' ', get_body_class() ) ),
    	'context' => 'body',
    ) );
    do_action( 'genesis_before' );
    
    genesis_markup( array(
    	'html5'   => '<div %s>',
    	'xhtml'   => '<div id="wrap">',
    	'context' => 'site-container',
    ) );
    
    do_action( 'genesis_before_header' );
    
    <img src="<?php header_image(); ?>" height="<?php echo get_real_estate_header()->height; ?>" width="<?php echo get_real_estate_header()->width; ?>" alt="" />
    
    do_action( 'genesis_after_header' );
    
    genesis_markup( array(
    	'html5'   => '<div %s>',
    	'xhtml'   => '<div id="inner">',
    	'context' => 'site-inner',
    ) );
    genesis_structural_wrap( 'site-inner' );

    Then I added this code to my page template…

    <?php
    /**
     * This file adds the Real Estate Home Page template to the News Child Theme.
     *
     * @author Derek Alvarez
     * @package News
     * @subpackage Customizations
     */
    
    /*
    Template Name: Real Estate Home Page
    */
    
    // Remove header, breadcrumbs, footer widgets 
    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 );remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs');
    remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );
    
    add_action( 'genesis_after_header', 'real_estate_header' );
    
    genesis();

    Then I added this to my functions.php file…

    /** Add support for custom Real Estate Header */
    $args = array(
    	'width'         => 960,
    	'height'        => 120,
    	'default-image' => get_template_directory_uri() . '/images/cc-header-real-estate.jpg',
    );
    add_theme_support( 'real-estate-header', $args );

    But that broke my site. What am I doing wrong?

    #79188

    braddalton
    Participant
    Post count: 9415
    #79261

    derekalvarez
    Participant
    Post count: 47

    It appears this is for making the featured image for each page become the header.

    How can I make this work for a specific header image I want to use for all pages with “real-estate” or “idx” as their parent?

    Would it be something like…

    add_action ( 'genesis_before_header', 'real_estate_header' );
    function real_estate_header() {
     
    echo '<div class="real-estate-header">
    <div class="wrap">
    <img src="get_template_directory_uri() . '/images/cc-header-real-estate.jpg" />
    </div>
    </div>';
    }
     
    }

    Sorry, I know just enough code to be dangerous!

    #79504

    derekalvarez
    Participant
    Post count: 47

    Alright, I have now managed to get the header in there, but I don’t know how to center it or link it to http://cortezcolorado.net/real-estate. Where I’m at now is the only code I have is this, which I put in my page_real_estate_home.php template file…

    <?php
    /**
    
        This file adds the Real Estate Home Page template to the News Child Theme. *
        @author Derek Alvarez
        @package News
        @subpackage Customizations */
    
    /*
    Template Name: Real Estate Home Page
    */
    
    // Remove header, breadcrumbs, footer widgets
    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 );remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs');
    remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );
    
    add_action ( 'genesis_before_header', 'real_estate_header' );
    function real_estate_header() {
    
    global $post;
    
    {
    echo '
    ';
    echo '';
    echo '
    ';
    }
    
    }
    
    genesis();
    #79789

    derekalvarez
    Participant
    Post count: 47

    I just realized it ate my code! Here’s the correct code…

    https://gist.github.com/derekalvarez/8008701

    • This reply was modified 8 months, 2 weeks ago by  derekalvarez.
    • This reply was modified 8 months, 2 weeks ago by  derekalvarez.
    #79818

    derekalvarez
    Participant
    Post count: 47

    I have the header centered and linking to the page I want. Here’s the code I used…

    https://gist.github.com/derekalvarez/8008701

    I also added some css…

    .real-estate-header {
    	background-color: #fff;
    	border-left: 1px solid #d5d5d5;
    	border-right: 1px solid #d5d5d5;
    	border-top: 1px solid #d5d5d5;
    	height: 120px;
    	margin: 0 auto;
    	overflow: hidden;
    	width: 960px;
    }

    Now what do I have to do to make sure each page puts my Genesis SEO meta info into each page’s header?

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

You must be logged in to reply to this topic.