The MU forums have moved to WordPress.org

Home page with the last post of all the network blogs (10 posts)

  1. blogmarket
    Member
    Posted 16 years ago #

    Hi people...
    i need an home page that "collect" all the last post of the network...

    for example...i have 7 blogs on the network...i need in the home page the last post of each blog...

    what can i do??

    pls help me! :D

  2. andrea_r
    Moderator
    Posted 16 years ago #

    Search for "most recent posts" or 'latest posts".

  3. theapparatus
    Member
    Posted 16 years ago #

    That's not going to work in this case if one blog as a number of posts after another one has. I believe the poster is looking for 1 post from each blog.

    Easiest method is to hard code the page to grab the last post from each specific blog usinf the fetch_rss feed, set to grab only one post from each rss.

    Take a look at your wp-admin/index-extra.php file to see usage of the fetch_rss function.

  4. blogmarket
    Member
    Posted 16 years ago #

    i use chis code

    <div class="recent-posts">
    <h2>Recent Posts</h2>
    <?php
    $blogs = get_last_updated();
    foreach ($blogs as $blog) :
    // we need _posts and _options tables for this to work
    $blogOptionsTable = "wp_".$blog['blog_id']."_options";
    $blogPostsTable = "wp_".$blog['blog_id']."_posts";

    // we fetch the blog name
    $opt2 = $wpdb->get_col("SELECT option_value FROM $blogOptionsTable WHERE option_name='blogname'");

    // we fetch the latest post
    $opt3 = $wpdb->get_row("SELECT * FROM $blogPostsTable WHERE post_status='publish' AND post_type='post' ORDER BY post_date DESC LIMIT 0,1");

    // sometimes the guid is missing, so just use blog url
    if (trim($opt3->guid)) {
    $mypostlink = trim($opt3->guid);
    } else {
    $mypostlink = 'http://'.trim($blog['domain']);
    }

    $myposttitle = '<big><b>'.$opt3->post_title.'</b></big><br/>';
    $mypostdetails = '<small>from '.trim($blog['domain']).' on '.strftime("%A, %B %d, %Y at %I:%M %p",strtotime($opt3->post_date)).'</small><br/>';
    $mypostcontent = ''.$opt3->post_content.'';

    print '<div class="post">'."n".$myposttitle."n".$mypostdetails."n".$mypostcontent."n</div>n";

    endforeach;
    ?>
    </div>

    i use it in the index.php into my theme directory...

    but i need to load it only if the root blog and not in the subdir blog...

    any ideas??

  5. dsader
    Member
    Posted 16 years ago #

    WPMU can activate themes on a one theme/one blog basis:

    1. Deactivate the custom theme: SiteAdmin-->Themes then
    2. Activate your theme only for the root blog: SiteAdmin-->Blogs-->Edit-->Blog Theme-->check box(only deactivated themes are listed)
    3. Activate the custom theme in the usual manner.

  6. blogmarket
    Member
    Posted 16 years ago #

    tnx a lot...
    i'll try this evening :D

  7. theworkisdone
    Member
    Posted 16 years ago #

    Why not query all public blogs, get each Blog-URL, and grap only one post of every blog-rss-feed, speak $blog_url."/feed" Blogfeeds are being cached, and its only one db query.

  8. theworkisdone
    Member
    Posted 16 years ago #

    So you can have a list, with the most recent post from *every* public blog.

    * Blog 1 with its recent post.
    * Blog 2 with its recent post.
    * Blog 3 with its recent post.
    * ...

    you get the idea.

  9. theapparatus
    Member
    Posted 16 years ago #

    That's what I suggested up a few posts.

  10. carnold
    Member
    Posted 16 years ago #

    I am trying this also with the rss = @fetch_rss from index-extra.php but i am not exactly sure how to use this. Can someone explain how to use this function?

About this Topic

  • Started 16 years ago by blogmarket
  • Latest reply from carnold