From time to time you need data from WordPress, but should not displayed in the system; they are necessary outside the installation. There are basically two options. Content can be quite easy provide via feed and processed or you gain access to the system. And that is basically very simple and is briefly described here.
In an article about Google News, I have already explained how the data can be accessed, even if the output takes place in the root of the WordPress installation. Basically you can access from anywhere the data. Since WordPress 2.5 it’s
wp-load.php, alternatively and in older versions you simply use the
wp-config.php. In addition, the
wp-blog-header.php gets even earlier withdrawn and thus may be more suitable.
The following small example ties the file and output the markup and design of the active theme, therefore I use here the access to the content and settings of WordPress, since I use the functions of WordPress integration. This works, as the
wp-load.php build a bridge to all other functions in WordPress is.
<?php 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.
<?php echo $_SERVER['DOCUMENT_ROOT']; ?>
This is then used in the
require command, and can now, as usual, use the features of WordPress.