WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Outside WP Directory (4 posts)

  1. jimid
    Member
    Posted 6 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/
    (http://domain.com/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
    Member
    Posted 6 years ago #

  3. whooami
    Member
    Posted 6 years ago #

    jimid,
    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();
    the_title();
    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. jsherk
    Member
    Posted 6 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