WordPress.org

Support

Support » How-To and Troubleshooting » ABSPATH to header php

ABSPATH to header php

  • 1.3 Alpha 4 here. Am I right in saying that the new index file checks to see if there is a file called header php in the WP root directory and else it loads the default wp-header OR does it check in the theme directory for the alternative header php file ? ie its ABSPATH to what ?

Viewing 15 replies - 1 through 15 (of 20 total)
  • Yes but in the theme dir I can’t get it to pick up header php. Am I doing something wrong? . And thank G you are here beel 🙂

    Well mine does not (not quite) 🙂

    In my install (latest nightly) the theme index takes footer php from the root directory – not the theme directory. It rather wrecks the theming switching idea at least temporarily. I do not know if its a file path typo or something or indeed how it is meant to work.

    So: Only one theme with alternative sub files can be installed at once. Have I got it right?

    Well that is fine and makes perfect sense. But I can not get my theme index file to pick up my theme footer file.

    Hmm, make sure that index.php, wp-header, wp-footer, etc. in the root directory is the default install from WP. Also make sure footer.php, etc. is not in the root directory (they should be in your theme directory) and that you have include(footer.php), etc. in your index.php (the one in the theme directory).
    I think that should cover all the bases. Maybe not?

    When wp-blog-header runs it comes across this:
    else if (is_home() &&
    file_exists(“$wp_template_dir/index.php”)) {
    $wp_did_template_redirect = true;
    include(“$wp_template_dir/index.php”);
    exit;
    thereby running your selected theme index file which has the include for your header sidebar and footer.

    Thanks I am trying all that now.

    I have that but my index file will not pick up either footer or wp-footer for example from its own theme dir.

    Fine. Fixed it. You need the full file path. No problem.

    huh? full path? Hmmm, something else must be amiss as I don’t have the fullpath. I’ll have to explore further once I get back to my computer. Glad you got it, though.

    From /wp-content onwards.

    Includes are relative to the theme directory. In your theme’s index.php, do this:
    <?php include('footer.php'); ?>
    footer.php should live in the theme directory next to index.php. That’s all you need. Don’t bother with wp-footer.php. That’s for the default index, which you’re not using since you’re using a theme.

    It was the ABSPATH malarkey which confused me. Until I put in a long path it just would not run. I didnt know if it was a glitch or whether it should be like that ?

    rboren: I’ll have to take a look when I get back to my computer but I have the relative path to footer.php (and it works), however, if there is a footer.php in the root directory that gets included instead.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘ABSPATH to header php’ is closed to new replies.
Skip to toolbar