Community Forums › Forums › Archived Forums › Design Tips and Tricks › Different Headers on Pages
Tagged: header
- This topic has 12 replies, 4 voices, and was last updated 10 years, 4 months ago by derekalvarez.
-
AuthorPosts
-
October 28, 2013 at 2:59 pm #69519virtualMember
Is there a way to change the header for specific pages?
http://hg.virtuallyassistingu.com/October 28, 2013 at 3:31 pm #69526emasaiParticipantTry 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.comOctober 28, 2013 at 6:13 pm #69552virtualMemberThis is great info. Thanks so much. I should be able to get it done for specific pages.
December 13, 2013 at 1:36 pm #78865derekalvarezMemberWhat 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?
December 13, 2013 at 4:06 pm #78909Brad DaltonParticipantIf 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/
December 13, 2013 at 4:15 pm #78918derekalvarezMemberThanks, 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?
December 14, 2013 at 3:43 pm #79116derekalvarezMemberHi 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?
December 14, 2013 at 4:55 pm #79127derekalvarezMemberI'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?
December 15, 2013 at 12:08 am #79188Brad DaltonParticipantDecember 15, 2013 at 12:06 pm #79261derekalvarezMemberIt 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!
December 16, 2013 at 12:59 pm #79504derekalvarezMemberAlright, 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();
December 17, 2013 at 11:17 am #79789derekalvarezMemberI just realized it ate my code! Here's the correct code...
December 17, 2013 at 2:47 pm #79818derekalvarezMemberI 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?
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.