Support » Fixing WordPress » is my include a PHP or WP problem?

  • Resolved moody

    (@moody)


    I don’t know either PHP well enough or WP enough.
    My WP is in the root. I’ve broken it up to do a bunch of including. This works all fine and good except when I try to call up those includes from different directories.
    For example, my archive is a separate include:
    <h3><?php _e('Archives:'); ?> im inked</h3>

      <?php wp_get_archives('type=monthly'); ?>

    From WP in the root, this comes up fine with this:
    <?php include('incs/inc_arch.php'); ?>
    But if I do this from another directory that has nothing to do with WP, I use this:
    <?php include('../incs/inc_arch.php'); ?>
    And then I get this:
    Fatal error: Call to undefined function: _e() in /home/user/public_html/website/incs/inc_arch.php on line 1
    What more do I need to do or what am I doing wrong?
    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • good thinking. that’s what i tried, but i got this:
    Fatal error: Call to a member function on a non-object in /home/user/public_html/website/wp-includes/wp-l10n.php on line 37
    and if i change the included to be wp ready, i’m sure some fatal loop occurs because now on the WP i get this:
    Warning: main(../wp-blog-header.php): failed to open stream: No such file or directory in /home/user/public_html/website/incs/inc_arch.php on line 3
    Fatal error: main(): Failed opening required ‘../wp-blog-header.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/user/public_html/website/incs/inc_arch.php on line 3

    Take that blog-header.php section out of your include file and use this statement instead for calling the include module
    <?php include(ABSPATH . 'path/filename.php'); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.