tags:

views:

170

answers:

4

With full access to both db , order last ten post from two different wordpress blogs, ordering by post date. In local way, not using foreign services (with sql and php for example)

A: 

You could fetch the feeds of both blogs, convert them to a PHP array and then order this array by the post date.

powtac
A: 

//Establish connections with both databases as $link1 and $link2

//Using $link1 execute this query SELECT post_title FROM wp_posts WHERE post_status="publish" ORDER BY Post_Date DESC LIMIT 10

//Using $link2 execute the same query as above on a different server

Here is a link to the DB schema http://www.dijksterhuis.org/wp-content/uploads/2008/09/wp_db_schematics_v1_0.png

Webber
A: 

Graeme Lawton posted something vaguely related on his blog last Monday. It was specifically related to creating a unified view of all blogs on a WordPress MU installation, but, given my understanding of the hack that is WordPress MU, I suspect that doing the same thing with two completely separate WordPress installs should be fairly similar.

(Not that he really goes into much detail about how he did it, but I'm sure he'd be willing to share his solution if you asked.)

Dave Sherohman
+1  A: 

http://magpierss.sourceforge.net/

<?php
require_once 'rss_fetch.inc';

$url1 = 'http://yoursite.com/feed/';
$rss1 = fetch_rss($url1);

$url2 = 'http://yourothersite.com/feed/';
$rss2 = fetch_rss($url2);

$rss_items=array_merge($rss1->items,$rss2->items);

// sort / filter items

foreach ($rss as $item ) {
    $title = $item[title];
    $url   = $item[link];
    echo "<a href=$url>$title</a></li><br>
";
}
?>
b82
+1 start with the rss widget ...
le dorfier