Hello, I have multiple separate installations of WordPress blogs on my website in directories such as /blog, /news & /journal. In my main site (non-wp) index.php page I am trying to put multiple WordPress Loops to connect to each individual blog and display the most recent post from each. Like a preview of each of my different blogs for the people who visit my home page and to keep fresh content on my home page.
I successfully made it get the most recent post from one blog. But once I add a second WordPress Loop into the page it just returns a duplicate display of the same data from the first blog, even though in the second Loop the settings are set for the second blog.
To me it seems as though the connection to the database from the first Loop is still open for the second Loop or some variables are not being reset from the first Loop before the second Loop starts.
I've searched for a while and have not found a solution.
I've asked for help on the WordPress Support Forum as well but no one has known how to fix this yet. Others have suggested using feeds but I would really like to just use the WP Loop. See that thread here: http://wordpress.org/support/topic/50044
Here is my index.php code...
<?php
require_once('news/wp-blog-header.php');
?>
<?php query_posts('posts_per_page=1'); ?>
<h1 id="header"><a>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a></h1>
<!-- // loop start -->
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_date('m-d-y', '<h2>','</h2>'); ?>
<h3 id="post-<?php the_ID(); ?>"><a>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<?php link_pages('Pages: ', '', 'number') ?>
<em>Posted by <strong><?php the_author() ?></strong></em>
Filed under: <?php the_category(',') ?>
<?php comments_popup_link('0 comments', '1 comment', '% comments') ?>
<?php comments_template(); ?>
<!-- // this is just the end of the motor - don't touch that line either :) -->
<?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
<?php endif; ?>
<br><br>
<?php
require_once('journal/wp-blog-header.php');
?>
<?php query_posts('posts_per_page=1'); ?>
<h1 id="header"><a>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a></h1>
<!-- // loop start -->
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_date('m-d-y', '<h2>','</h2>'); ?>
<h3 id="post-<?php the_ID(); ?>"><a>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<?php link_pages('Pages: ', '', 'number') ?>
<em>Posted by <strong><?php the_author() ?></strong></em>
Filed under: <?php the_category(',') ?>
<?php comments_popup_link('0 comments', '1 comment', '% comments') ?>
<?php comments_template(); ?>
<!-- // this is just the end of the motor - don't touch that line either :) -->
<?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
<?php endif; ?>