How to display posts from another WordPress

Have a WordPress site need to integrate blog posts from another WordPress site.  Both are in same host, but in different domain.

After seach, I just found there is not much solution for this on the internet. Finally my solution is Inspired by this post: WordPress- Query Posts from another wordpress blog on the same server 
I wrote some function for this. It need to be put in your_theme/functions.php

Then, we can to use them in template file.

First, go to admin add two new page:
  • One is blog index page. I use ‘blogs’ as slug.
  • Another is post single page. I use ‘blog-post’ as slug.
You can copy your index.php as your blog index template. Here is my code:

That’s it. Then you add this template to blog index page. And should list all the post from remote wp site.

And now lets make the post single template.

Also, add this template to the ‘blog-post’ page.

All done!
I just skipped the part of category. You can try it yourself.

Leave a Reply