Support » Plugins » static front page with RSS feeds

  • Let me explain.. I have 2 blogs under root as a & b. I created static index.php providing lings to the blogs. Now I want to add the RSS feeds or last 3posts from blog a & blog b onto the static front page which when clicked should go the coresponding..
    After going thru the support forums I came across this code:

    <?php
    require_once(“../saik/wp-blog-header.php”);
    define(‘WP_USE_THEMES’, true);
    ?>

    <?php
    $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; ?>

    This is working fine as I get the last 3 posts from blog a to static page. But how to get the last 3 posts from blog b in to the static page?
    Anyone has idea..

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • whooami

    (@whooami)

    Member

    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.

    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.

    whooami

    (@whooami)

    Member

    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘static front page with RSS feeds’ is closed to new replies.