WordPress 您的足迹 功能

add this plugin:cos_visitor_comment

OR

<?php
    if($_COOKIE["comment_author_" . COOKIEHASH]!=""){
        global $wpdb;
        $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_author_email, comment_type, comment_author_url, SUBSTRING(comment_content,1,25) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND comment_author = '".$_COOKIE["comment_author_" . COOKIEHASH]."' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT 5";
        $comments = $wpdb->get_results($sql);
        foreach ($comments as $comment) {
            $output .= "\n<li><a href=\"" .get_permalink($comment->ID)."#comment-".$comment->comment_ID. "\" title=\"" . $comment->post_title . " 上的评论\">".strip_tags($comment->comment_author).": ". strip_tags($comment->com_excerpt) ."</a></li>";
        }
        $output = '<h3>您的足迹</h3><ul>'.$output.'</ul>';
        $output = convert_smilies($output);
        echo $output;
    }
?>

via:http://wange.im/show-your-recent-comments-in-wordpress.html

<?php
if($_COOKIE["comment_author_" . COOKIEHASH]!=""){
//1.如果COOKIE不为空,则输出您的足迹
global $wpdb;//2.读取数据库相关项
$sql = "SELECT DISTINCT ID, post_title,post_password,
comment_ID, comment_post_ID,comment_author,
comment_count,
comment_date_gmt,comment_approved, comment_author_email,
comment_type,comment_author_url,
SUBSTRING(comment_content,1,25)
AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts
ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID)
WHERE comment_approved = '1' AND comment_type = ''
AND comment_author = '".$_COOKIE["comment_author_" . COOKIEHASH]."'
AND post_password = ''
GROUP BY comment_post_ID
ORDER BY comment_date_gmt
DESC LIMIT 10";//3.输出10篇文章
$comments = $wpdb->get_results($sql);
foreach ($comments as $comment) {
$output .= "\n<li><a href=\"" .get_permalink($comment->ID)."#comment-".$comment->comment_ID. "\" title=\"" . $comment->post_title ."(". $comment->comment_count."评论)\">" . $comment->post_title . "</a></li>";
}//4.输出最近评论过的文章
$output = '<h3><span>'.get_avatar($comment,$size='16'). mb_substr(strip_tags($comment->comment_author),0,12).'</span>您最近还阅读过:</h3><ul class="box">'.$output.'</ul>';
//5.标题格式为:头像+作者+文字
$output = convert_smilies($output);
echo $output;
}
?>

{ 发表评论? }

  1. test

    test

发表评论

电子邮件地址不会被公开。

 smiles smiles smiles smiles smiles smiles smiles smiles smiles smiles smiles smiles smiles smiles smiles smiles smiles smiles smiles smiles smiles smiles

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

无觅相关文章插件,快速提升流量