WordPress.org

Ready to get started?Download WordPress

Forums

query two different installs (1 post)

  1. colincameron
    Member
    Posted 8 years ago #

    I have two wordpress installations and in subdirectories and I would like to include the last five post titles from each on my main site.

    I can make the first work but the second list loads the first blogs links. Im assuming because I cant include the wp-blog-header.php twice.

    Can anyone think of a way to do this?

    this is the code im using for the first:

    <?php
    // Query Andfound's WordPress install for last 5 posts
    define('WP_USE_THEMES', false);
    include_once('andfound/_cms/wp-blog-header.php');
    query_posts('posts_per_page=5');
    ?>
    <dl>
    <dt>Recent Posts</dt>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <dd><a href="<?php the_permalink() ?>" title="get_the_title()"><?php get_the_title() ?></a></dd>
    <?php endwhile; ?>
    </dl>
    <?php else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif;
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags