WordPress.org

Ready to get started?Download WordPress

Forums

have header only show on home page (7 posts)

  1. cheri3714
    Member
    Posted 1 year ago #

    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!

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    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.

  3. viktor89
    Member
    Posted 1 year ago #

    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;
    }`

  4. cheri3714
    Member
    Posted 1 year ago #

    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?

  5. cheri3714
    Member
    Posted 1 year ago #

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

  6. Andrew
    Forum Moderator
    Posted 1 year ago #

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

  7. cheri3714
    Member
    Posted 1 year ago #

    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...

Topic Closed

This topic has been closed to new replies.

About this Topic