S
S
Shing2014-09-24 14:06:53
CMS
Shing, 2014-09-24 14:06:53

What is the best way to organize the mixing and output of posts from other WordPress sites on a Wordpress site?

There are N sites on wordpress.
What is the best way to organize mixing and output of posts from other WordPress sites on a WordPress site.
For example, I need to mix posts from the same category on different wp sites, etc.
Or is it easier to do multisite? That is, on one base, all N sites should be raised.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Vorotnev, 2014-09-24
@HeadOnFire

You can read posts from other WP sites via RSS, or even better, install JSON REST API on all sites . Then you can simply get specific posts, entire archives in JSON.
As for mixing - there are nuances. Mixing itself is not a problem, the property $postsof the object WP_Querystores all the posts received from the database for the current request. Plus, we have the same array or object received in JSON from other sites. We bring everything to the same format (object or array) and mix, output.
But here a few nuances pop up:
1. Pagination will not work correctly, or the number of posts on the pages will always be more than in the settings (after all, there will be native X + third-party Y)
2. The author of the post, metadata (categories, tags, etc.) of posts from another site are not in the current database, so it’s better not to display these things or display them in text (not links)
3. Something else will come out on trifles
If you do Multisite - it is more convenient, more comfortable, more pleasant, etc. But there this task will not be much easier. Multisite has a common table of users, tables of posts and metadata are different, each site has its own. Yes, you can switch to another blog on the fly, request posts from there, return to the current one and mix. This is instead of reading posts from another site via RSS or JSON. But further the same nuances. There are solutions for synchronizing metadata (categories, tags) between network sites, but this is already a complication, I'm not sure if this is necessary in this particular case.

A
Alex, 2014-09-24
@mr_ko

There is a plugin https://wordpress.org/plugins/hyperdb/ did not use, but it seems to be what you need. You can dig into the code and see how it connects to another database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question