WordPress.org

Ready to get started?Download WordPress

Forums

Different Header for Static Front Page (5 posts)

  1. bburns
    Member
    Posted 7 years ago #

    Is it possible to use a different header in the Static Front Page?
    I've uploaded a specific header (header_front.php) into my blog template, but I can't figure out how to call it through the "require" command:

    require('./blog/header_front.php');
    require('http://www.mysite/blog/wp-blog-header.php');
    require('http://www.mysite/blog/header_front.php');
    etc...

    Using the default calls my blog header, and that works fine, but is it possible to call "header_front.php" in my static front page?

  2. Andrew Ozz
    WordPress Dev
    Posted 7 years ago #

    It is, with the is_page(xx); where xx=page's ID, or you can use an if - else in your theme's header.php to change what is displayed on the front page. Like that:

    <?php if ( is_page(xx) ) { ?>
    -- put your stuff here --
    <?php } else { ?>
    -- normal header --
    <?php } ?>
  3. bburns
    Member
    Posted 7 years ago #

    Azaozz,
    Thanks for this tip.
    I may be doing thing wrong, but I have my static front page as a separate index.php file outside my WP folder. I don't edit through WP, and therefore I'm sure how to assign it a number.
    Does "if_else" work with a direct url? Or, is there a way to number my index.php?
    Thanks again.

  4. rudolf45
    Member
    Posted 7 years ago #

    "include" never works with an URL, only with server path!

    And if your file is not part of WP, I don't really understand what are you trying to do.

  5. bburns
    Member
    Posted 7 years ago #

    I have an index.php file in the root directory and I'm trying to use it as a Static Front Page. The way I understand it, I need to pull the header with:

    <?php
    define('WP_USE_THEMES', false);
    require('./wordpress/wp-blog-header.php');
    get_header();
    ?>

    which works fine, but I would like to use different header.
    And if it isn't obvious already, I don't have a firm grasp on php.
    Have I misunderstood how to create a Static Front Page?

Topic Closed

This topic has been closed to new replies.

About this Topic