• Resolved pearcedk

    (@pearcedk)


    I am trying to have my header image only on the main page in order to not be repetitive on individual post pages. I still want the navigation, just not the image. How I do this?

    So far I have this in the header.php child theme file…

    <body <?php body_class(); ?>>
    	<div id="page" class="hfeed site">
    
    	<header id="masthead" class="site-header" role="banner">
    
    	<?php
    
    	if (is_page_template('index.php') ) { ?>
    
    			<a class="home-link" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
    
    				<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
    				<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
    			</a>
    
    	<?php } ?>
Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator t-p

    (@t-p)

    Try using conditional tag, for example:

    <?php if(is_home() || is_front_page() ):?>

    Thread Starter pearcedk

    (@pearcedk)

    That either didn’t work or I don’t know how to implement it. How would it be applied to the code above?

    Moderator t-p

    (@t-p)

    Try replacing this:
    <?php

    if (is_page_template(‘index.php’) ) { ?>

    With this:

    <?php if(is_home() || is_front_page() ):?>

    Hope it works.

    Thread Starter pearcedk

    (@pearcedk)

    Tara, I appreciate the help but it unfortunately didn’t work.

    Try this:

    <?php if ( is_home() || is_front_page() ) { ?>
        <a class="home-link" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
            <h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
             <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2></a>                                                             <?php } ?>
    Thread Starter pearcedk

    (@pearcedk)

    O-M-G. It worked like a charm! Thanks WPRanger!

    Where exactly should I put the code that WPRanger wrote in the header.php? Thanks

    Ok. I′ve found it! Thanks!

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Yeah copy the header.php file from the parent theme and then paste it into your Child Theme – then you can work on the header.php file (from within your Child Theme) safely.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘TwentyThirteen Header Image only on Main Page?’ is closed to new replies.