Display Recent Posts outside the WordPress

How to import recent post from your internal blog to your website without any difficulties.
First you need to create wp-latest-blogs.php file where you include wp-load.php for your wp blog.

    * WoredPress Latest blog entries
    * @package WordPress
    require( './blog/wp-load.php' );
    // Load the recent top 10 posts
    query_posts( 'posts_per_page=10' );
    <div id="blogPosts">
    <ul id="blogList">
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
    <?php the_title(); ?><span class="date"><?php the_time('F jS, Y') ?></span></a>
    <?php endwhile; ?>
    <?php endif; ?>

After that you need to create an Ajax query to visualize the content of your blog anywhere in your website.

<div id="blogPostsWrapper">Loading... </div>
    <script type="text/javascript">
    $.get('wp-latest-blogs.php', function(data) {

Source: http://ddqnov.com/blog/display-recent-posts-outside-the-wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *