[resolved] Outside WP Directory (4 posts)

  1. jimid
    Posted 7 years ago #

    Im looking to post wp content outside of its directory.
    at the web root i have an index.php. (http://domain.com/index.php)
    wp is the directory: root/blog/
    what im looking to do is post 5 recent post titles and there links on the index.php at the root.

    What would be the best way of doing this?

  2. Khairil Zhafri
    Posted 7 years ago #

  3. whooami
    Posted 7 years ago #

    here is an example:

    in the php file you want to put content from your blog in

    <?php require('./blog/wp-blog-header.php');
    if (have_posts()) : while (have_posts()) : the_post();
    endwhile; else:
    endif; ?>

    that will pull all your titles

    you can user query_posts or any other variation of the loop to pull content, titles, etc.. just make sure that you load wp-blog-header.php

  4. Jeff Sherk
    Posted 7 years ago #

    I just upgraded to WP 2.5 and the above code returns nothing (0 posts) even though there are posts. The code worked fine with WP 2.3

    Is this a bug or did something change?

Topic Closed

This topic has been closed to new replies.

About this Topic