user1666195
user1666195

Reputation: 33

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

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?

Upvotes: 2

Views: 1359

Answers (2)

Jude Okoroafor
Jude Okoroafor

Reputation: 484

Just like the above answer

This worked for me

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

Upvotes: 0

Stormsson
Stormsson

Reputation: 1551

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)

Upvotes: 1

Related Questions