You use the RSS feed from each blog.
Doing it via the database calls is more work than necessary and hasnt been shown to work anyway:
1. you need to include BOTH headers
2. Your opening simulaneous MySQL connections, and theyre not being closed before the other one is opened. (Wont work)
If youre just interested in grabbing data, use magpie.
Thread Starter
tired
(@tired)
Thanks whooami fore taking time to reply.
I tried as mentioned, giving Both headers and came thru ur script somewhere on forums abt closing mysql connection but somehow that did not work as I get feeds from blog a but not from blog b.
Here is the code:
<?php
require_once(“../a/wp-blog-header.php”);
?>
<?php
$connect = mysql_connect($dbname, $user, $password);
$lastposts = get_posts(‘numberposts=3’);
foreach($lastposts as $post) :
setup_postdata($post);
?>
” id=”post-<?php the_ID(); ?>”><?php the_title(); ?>
<?php the_content(); ?>
<?php endforeach;
mysql_close($connect); ?>
<?php
require_once(“../b/wp-blog-header.php”);
?>
<?php
$connect = mysql_connect($dbname, $user, $password);
$lastposts = get_posts(‘numberposts=3’);
foreach($lastposts as $post) :
setup_postdata($post);
?>
” id=”post-<?php the_ID(); ?>”><?php the_title(); ?>
<?php the_content(); ?>
<?php endforeach;
mysql_close($connect); ?>
I replaced the $dbname as correct db name and also for un & pwd.
Iam really not into programming..
Thanks.
and like Ive already said, thats not going to work, AND your making uneccessary db calls — you 2 blogs already allow for syndication using the feeds.
Use magpie.
Its already installed with wordpress. OR, if you like there is a very simple stand alone install (google magpie, for the download page, its all of 4 or so actual files).
Youre doing the things the hard way by making db calls.
Hi Tired
Did it work? I would like to see your site, cause I want to do something similar, displaying several feeds in one page, side by side, so to speak.
Jesper