Using Wordpress "Template Tags Outside of Wordpress"
Hey I'm doing some php development work for free for my friend and he is using wordpress for a blog, but it's a video site & while I could do something clever within wordpress itself, I want to move outside of wordpress since it isn't my specialty but I would like to be able to retrieve Wordpress information and while it would be quite plausible for me to simply create php to retrieve data from the database wordpress has a lot of template tags already in existance. What I would like to be able to do is utilise these tags in my project.
So my question is, how can this be achieved?
In case it is 开发者_JS百科important. Wordpress is installed in the document root and it's currently sharing that root with my external site. so in other words the index.php of wordpress is in the same folder as the "index.php" of my other one, though obviously not called the same thing.
You could "load" WP functions, with this 3 lines
$file = dirname(__FILE__);
$file = substr($file, 0, stripos($file, "wp-content") );
require( $file . "/wp-load.php");
After that you can use any WP function, or custom function or anything you want.
精彩评论