Accessing wordpress functions from other page outside wordpess.

Excerpt from http://wpengineer.com/embed-wordpress-functions-outside-wordpress/:


This works, as the wp-load.php build a bridge to all other functions in WordPress.

require( '../my_wordpress_install_root/wp-load.php' );
get_header();
 
echo 'new content outside WordPress';
 
get_footer();
?>
Depending on where the data is needed, it could be, that the absolute path of WordPress is needed. This can be determined by creating a php file with the following contents, put it in the Root of the installation and call it directly. The output is the path to the file.
 echo $_SERVER['DOCUMENT_ROOT']; ?>
This is then used in the require command, and can now, as usual, use the features of WordPress.

0 komentar:

Posting Komentar