开发者

Accessing WordPress categories from outside

开发者 https://www.devze.com 2023-02-10 19:41 出处:网络
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 tu

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号