• Resolved Ryan Fitzer

    (@ryanfitzer)


    When I create a static page outside of the directory I’m getting errors when trying to include the footer and header. It cannot find the dynamic info (blog name, copyright, etc…) and therefore fails to display the content (template included) correctly. Any thoughts?

Viewing 15 replies - 1 through 15 (of 30 total)
  • moshu

    (@moshu)

    You have to add on the top of any file that needs to use WP functions, the following:
    <?php
    require('./path-to/your-blog/wp-blog-header.php');
    ?>

    Right on the top, before everything.

    Thread Starter Ryan Fitzer

    (@ryanfitzer)

    Thanks. I’m still having a problem. Here’s the code (without any content stuff so it’s easy to read):

    <?php
    require('./wordpress/wp-blog-header.php');
    ?>

    <?php get_header(); ?>

    <!-- content ................................. -->
    <div id="singletop"></div>
    <div id="content">
    </div> <!-- /content -->

    <?php get_footer(); ?>

    My blog address is located in my “wordpress” folder in the root directory.

    Here is the error I get:

    Fatal error: main(): Failed opening required ‘./wordpress/wp-blog-header.php’ (include_path=’.:/usr/local/lib/php’)

    And it goes on to tell me that the error is on line 2. What am I doing wrong?

    Thanks so much for your help.

    Ryan

    Thread Starter Ryan Fitzer

    (@ryanfitzer)

    By the way, the directory for this page is as follows:

    wordpress/wp-content/2005/2005.php

    Thread Starter Ryan Fitzer

    (@ryanfitzer)

    One more thing. It has it’s own folder because it has an images folder and thumbs folder that it draws from. I plan on duplicating these folders in their own directories (2004, 2003, 2002, etc..). This way I do not have to chance any of the HTML. Makes my life a lot easier.

    Ryan

    ladydelaluna

    (@ladydelaluna)

    ./wordpress/wp-blog-header.php isn’t going to work since the path to the header isn’t in the wordpress folder – it’s probably in something like

    /wordpress/wp-content/themes/yourtheme/wp-blog-header.php

    Kafkaesqui

    (@kafkaesqui)

    By the way, the directory for this page is as follows:

    Then you should try:

    <?php
    require('../../wp-blog-header.php');
    ?>

    Look up “relative paths” in your favorite search engine for helpful info on the topic.

    Thread Starter Ryan Fitzer

    (@ryanfitzer)

    My “wp-blog-header.php” is in my wordpress folder. “header.php” is in my themes folder.

    When I use an absolute path to my header (header.php), some things work but the dynamic content does not show up. Plus, it leaves out the whole template.

    Thread Starter Ryan Fitzer

    (@ryanfitzer)

    Thanks Kafkaesqui and ladydelaluna. Still the same error message.

    ladydelaluna

    (@ladydelaluna)

    try using the entire url – from http onward…

    Thread Starter Ryan Fitzer

    (@ryanfitzer)

    Tried that also. Now it tells me:
    Fatal error: Call to undefined function: get_header()
    I’m going bonkers. That function works when the page is created through the WP Admin. But when I tried to type in the url of any page in my theme directory it says the same thing.

    moshu

    (@moshu)

    Just for lady:

    wp-blog-header.php and (a theme’s) header.php are two (2) very different things!

    moshu

    (@moshu)

    when I tried to type in the url of any page in my theme directory it says the same thing

    I am not sure I understand this. What exactly are you trying to do?

    ladydelaluna

    (@ladydelaluna)

    i think he’s trying to get his theme’s header to show up elsewhere, and has saved it in another location… sorry if i misunderstood.

    Thread Starter Ryan Fitzer

    (@ryanfitzer)

    No, the header is in the same place it always has been, my theme’s folder. I understand the reason for moshu’s solution but it isn’t working. Thanks for trying though guys.

    Ryan

    ladydelaluna

    (@ladydelaluna)

    i think the problem is that you’re trying to use stuff inside the wordpress theme to make pages outside the wordpress directory…

    why not just install wp on the root dir and then build a blog from that?

Viewing 15 replies - 1 through 15 (of 30 total)
  • The topic ‘including dynamis info outside of directory’ is closed to new replies.