V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
joynic
V2EX  ›  问与答

wordpress的author.php中显示作者最新评论过的文章。

  •  
  •   joynic · Mar 28, 2012 · 3689 views
    This topic created in 5146 days ago, the information mentioned may be changed or developed.
    谷歌到这段代码实在调不通。请高手指点。

    <?php $querystr = "
    SELECT *
    FROM $wpdb->comments
    WHERE $wpdb->comments.comment_author = '".$curauth->user_login."'
    AND comment_approved = '1'
    ORDER BY comment_date DESC";
    $results = $wpdb->get_results($querystr, OBJECT);

    $i=0;
    foreach ($results as $comment) :
    ?>

    <?php echo $results[$i]->comment_content; ?>


    <?php $i++; endforeach; ?>
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2677 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 03:43 · PVG 11:43 · LAX 20:43 · JFK 23:43
    ♥ Do have faith in what you're doing.