Accessing WordPress categories from outside

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2011-02-13T23:21:02Z Indexed on 2011/02/13 23:25 UTC
Read the original article Hit count: 211

Filed under:
|

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):

<?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!

© Stack Overflow or respective owner

Related posts about php

Related posts about Wordpress