• janellebargar

    (@janellebargar)


    I would like to create a second header to use on landing pages.
    I have created a second header php named header-landing.php

    I believe I need to change the heading.php to actually call the second header but I’m lost in what to change in the file.

    website is heidistevenson.com

    Here is the code

    ?><!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <meta name="viewport" content="width=device-width" />
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    <link rel="profile" href="http://gmpg.org/xfn/11" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <!--[if lt IE 9]>
    <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
    <![endif]-->
    
    <?php wp_head(); ?>
    </head>
    
    <body <?php body_class(); ?>>
    <div id="page" class="hfeed site">
    	<?php do_action( 'before' ); ?>
    <nav id="site-navigation" class="navigation-main" role="navigation">
    			<h1 class="menu-toggle"><?php _e( 'Menu', 'truly_minimal' ); ?></h1>
    			<div class="screen-reader-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'truly_minimal' ); ?>"><?php _e( 'Skip to content', 'truly_minimal' ); ?></a></div>
    
    			<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
    		</nav><!-- #site-navigation -->
    	<header id="masthead" class="site-header clear" role="banner">
    		<hgroup>
    			<?php $header_image = get_header_image();
    			if ( ! empty( $header_image ) ) { ?>
    				<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
    					<img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
    				</a>
    			<?php } // if ( ! empty( $header_image ) ) ?>
    			<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    			<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
    		</hgroup>
    		</nav><!-- #site-navigation -->
    	</header><!-- #masthead -->
    
    	<div id="main" class="site-main">

Viewing 1 replies (of 1 total)
  • W.P. Ginfo

    (@wp-ginfo)

    You could use a plugin like:

    • ‘Custom Header Extended’
    • ‘WP Random Header’
    • ‘Custom Header Images’
    • etc…

    Alternatively:

    <!-- add variabele headerimage -->
    <img src='<?php echo get_post_meta($post->ID, 'banner', true); ?>' />
    <!-- END add variabele headerimage -->

    Place the above code in header.php, above the navigation.
    This creates an extra field-option in the dashboard-editor-page.
    add field: banner
    value: [‘path to the image’] (make sure the entered path is CORRECT!)

Viewing 1 replies (of 1 total)

The topic ‘Adding a second Header’ is closed to new replies.