WordPress.org

Ready to get started?Download WordPress

Forums

Conditional tags in header (2 posts)

  1. michaelphill
    Member
    Posted 6 years ago #

    I'm trying to use the same header across my entire site and have successfully used conditional tags to generate a separate front page and single post page using this code:

    `
    <!--START HOME--><?php if ( is_home() ) { ?>

    HTML CODE GOES HERE FOR FRONT PAGE

    <?php } ?>
    <!--END HOME-->

    <!--START INSIDE-->
    <?php if ( is_single() ) { ?>

    HTML CODE GOES HERE FOR INSIDE PAGES

    <?php } ?>
    <!--END INSIDE-->

    However, I'd like the code where you see the words "HTML CODE GOES HERE FOR INSIDE PAGES" to apply to every page except the front page (i.e. category pages, archive pages). I'm not using some of the WordPress pages (such as the tag pages). I only know a little PHP and haven't been able to figure out the correct code to get this to work.

  2. Justin Tadlock
    Member
    Posted 6 years ago #

    Use:

    if(!is_home())

    Or, for WP 2.5 only:

    if(!is_front_page())

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.