Linking to files in different directory in PHP

My other question about getting help with the programming side of wordpress was labeled off topic for some reason so I’m asking a different way. I’m trying to embed my wordpress posts. I’m using this tutorial:

http://www.corvidworks.com/articles/wordpress-content-on-other-pages

Read More

The problem is with this code:

<?php

// Include WordPress 
define('WP_USE_THEMES', false);
require('./wordpress/wp-load.php');
query_posts('showposts=1');

?>`

When I try to run the page that this is inserted into, I get the error saying that file doesn’t exist. Pretending my domain is blah.com, the file is in www.blah.com/wordpress/wp-load.php and the page that includes this PHP code is in www.blah.com/other/page.php.

How do I change the syntax of the link on the require line to make sure it’s pointing to the right place since right now it doesn’t seem to be working?

Related posts

Leave a Reply

2 comments

  1. have you tried with

    require('../wordpress/wp-load.php');
    

    or anyway something like

    require('../../wordpress/wp-load.php');
    

    ?

    (depending on the depth of your file position)