WordPress Chinese Forums's Archiver

rem1x 发表于 2008-2-27 12:57

首页显示blog用户的最新文章,可行不?

默认安装mu之后,首页可以显示blog列表。
我想用户发布的最新日志也能在首页显示,不知道可行不可行?或者大家有更改成这样的吗?

litchi 发表于 2008-3-9 04:08

默认的theme里面只能显示最新更新的博客名称你说的有插件可以实现的可以看http://wpmudev.org/project/Most-recent-posts---updated下面的代码可以工作,但是要你自己整理一下[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>
';
    $mypostdetails = '<small>from '.trim($blog['domain']).' on '.strftime("%A, %B %d, %Y at %I:%M %p",strtotime($opt3->post_date)).'</small>
';
    $mypostcontent = ''.$opt3->post_content.'';

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

    endforeach;
    ?>
    </div>[/code]

[[i] 本帖最后由 litchi 于 2008-3-9 04:15 编辑 [/i]]

oxb 发表于 2008-4-10 23:04

我也想知道,请问有谁知道的吗?

litchi 发表于 2008-4-10 23:20

可以用wpmu-feed这个插件得到全站更新文章的rss,然后再参考wp后台首页显示rss的样式显示。
效果可以看爱写字的全站rss和爱写字后台显示的爱写字主站发表文章的rss

全站文章
[url]http://ixiezi.com/wpmu-feed/[/url]
全站评论
[url]http://ixiezi.com/wpmu-feed/comments/[/url]
全站页面更新
[url]http://ixiezi.com/wpmu-feed/pages/[/url]

wpbloger 发表于 2008-5-16 10:07

这里是全文输出,我想问下,只输出摘要,或者是一段文字,该怎么去定义$mypostcontent

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.