What i'm trying to achieve is bringing a loop from one WP site into another WP Site.

I used this method to get the loop into an external php file (which all works fine, the results show)

define('WP_USE_THEMES', false);

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <a href="<?php the_permalink() ?>"><?php the_title(); ?>" /></a>
<?php endwhile; endif;  ?>

I then try and include the file in my sidebar using a simple php include call but the results don't show.... I imagine this is because of some sort of confliction between my WP & the other sites WP.

Any help on achieving this?



If you want to grab info right off the page you should use one of these options if you don't want a plugin, the content can be returned and parsed as xml, rss, json or just html/text. This is the proper way to do this.

WordPress HTTP API: http://codex.wordpress.org/HTTP_API or
fetch_feed() ( for rss only).

ps. On side note I usually use simplexml instead of the built in rss wp stuff as it has way more functionality along with the HTTP API.

Also an alternative, though more troublesome way is to connect to the other database.


Use the FeedWordPress plugin instead.

  • This seems a little bulky for what i'm after. Also some of the loops will have things like star ratings & pictures in them so i need to be able to customise the loop. Thanks tho – Carpy Apr 18 '11 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.