WordPress functions (2)
|
Nov 29, 2005
|
For a while now, I've been trying to figure out how to use WordPress functions outside of the WordPress directory (i.e. in a different folder). I just found a few posts about it on some WordPress Support pages (1, 2, 3, 4). All you need to do is add this line of code to a PHP file:
<?php require($_SERVER['DOCUMENT_ROOT'].'/your-wordpress-directory/wp-blog-header.php'); ?>
After this statement is added, you can call any WordPress function. For example, if you wanted to include WordPress headers and footers and the sidebar on a template in your Zenphoto installation, you would just need to include the file mentioned above and use the standard WordPress functions (get_header(), get_sidebar(), get_footer()).
Note: $_SERVER['DOCUMENT_ROOT'] is a call to your site's root directory (www.domain.com is the root of www.domain.com/blog/). I'm not sure if it works everywhere, but it works for me. #technology
|
Linked: WordPress functions, Photo gallery
|
|