Support » Themes and Templates » have header only show on home page

  • Hi Everyone,

    I have a site that I am trying to have the header only show on the home page. The rest of the pages I want The navigation bar and the Drs name under it only.

    the link is http://www.ivandds.com

    I have tried making a template but when i try to connect it to another header file something goes horribly wrong.
    Any advice?

    Thanks!

    HAPPY HOLIDAYS!

Viewing 6 replies - 1 through 6 (of 6 total)
  • esmi

    (@esmi)

    Forum Moderator

    Use something like:

    <?php if( is_home() || is_front_page() ) :?>
    [ header markup goes here]
    <?php endif;?>

    in the appropriate existing template file (header.php?) within your custom theme.

    i think the easiest probably is to add this to the element you want to hide on the frontpage.

    class="<?php if(is_front_page() ) { ?> echo 'hidden_class' <?php } ?>"

    In your case the you’d change

    <img src="http://ivandds.com/wp-content/themes/NTT-Cindy-Theme/images/header.gif" alt="D Ivan Rodriguez" width="960px" height="320px" id="logo">

    to

    <img class="<?php if(is_front_page() ) { ?> echo 'hidden_class' <?php } ?>" src="http://ivandds.com/wp-content/themes/NTT-Cindy-Theme/images/header.gif" alt="D Ivan Rodriguez" width="960px" height="320px" id="logo">
    
    then you add the following to your "style.css" file:

    .hidden_class{
    display: none;
    }`

    esmi-

    thank you for the reply. I go tthe if statement working fine like this:

    if( is_home() || is_front_page() ):
    ?>
    <img src=”<?php bloginfo(‘template_directory’);?>/images/header.gif” alt=”D Ivan Rodriguez” width=”960px” height=”320px” id=”logo” />;
    <?php endif;
    ?>
    The only issue isI seem to have to refresh each page every time in order to get the rest of the pages to display right. So to build it on it I would rather a different header on the rest of the pages.

    With that said I tried and elde.. if:

    <?php
    if ( is_home() || is_front_page() )
    {
    <img src=”<?php bloginfo(‘template_directory’);?>/images/header.gif” alt=”D Ivan Rodriguez” width=”960px” height=”320px” id=”logo” />;
    }
    else
    {
    <img src=”<?php bloginfo(‘template_directory’);?>/images/top.gif” alt=”D Ivan Rodriguez” width=”960px” height=”320px” id=”logo” />;
    }
    ?>

    I get an arror that there is a syntax error on line 65. I cant find the error. Any suggestions from anyone?

    I ultimtely want the headers to look on perspective pages like this:
    http://www.c4-design.com/rodriguez/

    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    Can you post the contents of line 65, of which the error is referring?

    the error is actually referring to the calling up of the first image.

    In my original statement:

    if( is_home() || is_front_page() ):
    ?>
    <img src=”<?php bloginfo(‘template_directory’);?>/images/header.gif” alt=”D Ivan Rodriguez” width=”960px” height=”320px” id=”logo” />;
    <?php endif;
    ?>

    There are no issues. I didn’t change the way it is called up. I’m just attempting to call a different header on the other page???? confused…

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘have header only show on home page’ is closed to new replies.