So, I have a client that needs all the categories from their blog to be displayed on their homepage. The WordPress blog is in its own directory, /blog
. I have tried the following code (taken from a tutorial, I changed the path to fit clients site):
&开发者_如何转开发lt;?php
// Include WordPress
define('WP_USE_THEMES', false);
require('blog/wp-load.php');
query_posts('showposts=1');
?>
But this code just redirects me to the install file of WordPress (it actually wrongly redirects me). It goes to http://www.site.com/wp-admin/install.php
instead of http://www.site.com/blog/wp-admin/install.php
.
Is there a better way than this method? I would pull in the categories from the database table, but I do not currently have access.
Thanks!
Client is using a weird CMS that I just had to understand better. Also, I included wp-blog-header.php
instead.
精彩评论