[mark_c]就久伴个人而言,我觉得添加在最新文章上面这个位置最为恰当,因为你这个功能就是让有网站的站长玩的,既可以互动也可以引流,网上有很多教程,但是写的不详细,都有所保留,好多小伙伴都加在侧边栏,因为你压根不知道最新文章是那个php文件*-*[/mark_c]
效果图
说实话这个样式我还是不满意的,无奈忙里偷闲,将就一下吧,小伙伴们
教程
打开begin知更鸟主题更目录找到functions.php打开添加以下代码,只要你位置没添加错,报错不存在的
//最新评论排第一 function jiub($af){ global $wpdb; $queryaf="select comment_author, comment_author_url, comment_date from $wpdb->comments where comment_ID in (select max(comment_ID) from $wpdb->comments where comment_approved='1' and comment_author_url !='' and user_id='0' GROUP BY comment_author_email) ORDER BY comment_date DESC LIMIT $af"; $wally = $wpdb->get_results($queryaf); foreach ($wally as $commentaf){ $tmpy= "<li><i class=\"fa fa-spinner fa-pulse\"></i><a target=\"_blank\" href=\"".$commentaf->comment_author_url."\">".$commentaf->comment_author."</a></li>"; $outputy .= $tmpy; } $outputy = "<ul>".$outputy."</ul>"; echo $outputy ; }
打开更目录cms文件夹,找到cms-news.php打开并在以下截图红色标记的位置上面添加以下代码
<!-- 最新文章 --> <style> .jiub{width:100%;margin-bottom:10px;height:auto!important;background:#fff;border:1px solid #f5f9ff;text-align:center;color:#096cb2; border:1px solid #eaeaea;border-radius:4px;} .jiub p{padding-top:4px;font-size:17px;} .jiub ul{margin-top:10px;margin-bottom:10px;font-size:13px;padding-bottom:40px;margin-left: 36px;} .jiub ul li{list-style:none;float:left;margin-left:0px;margin-bottom:10px;width:16.6%;overflow:hidden;height:23px;text-align:left;} .jiub ul li img{width:20px;height:20px;margin-left:2px;margin-right:2px;} /*@media (max-width:820px) {.vistor{display:none}}*/ @media (max-width:820px) { .jiub ul li{width:25%;font-size:9px;} .jiub p{padding-top:4px;font-size:15px;} } .jiub i{ color:#000000; margin-right:6px; } </style> <div class="jiub"> <p>新评论将会排列第一</p> <?php jiub(24); ?> <div style="clear: both;display:block"> </div> </div>
打开header.php在中间添加以下css外链,外链是我网站的链接,你自己也可以本地化
<link href="https://jiubx.com/wp-content/themes/begin/css/font-awesome.css" rel="stylesheet">
加群入久伴博客官方微信群
加入久伴官方微信群有啥优势?
1.文章内部资源由于时间久远可能失效,加群,群内可以第一时间反馈
2.网站中教程不一定适用任何人,加群可以第一时间咨询并解决您得疑惑
3.你游荡于互联网,也需要群体,加群一起互动交流,畅所欲言
扫描下方二维码即可加入交流讨论

然而我不是知更鸟主题~~
其实代码可以通用
多谢大佬的分享
实用就行
不错!涨知识了。
实用就行
都喜欢加这个东西https://www.mosq.cn/usr/themes/handsome/usr/img/emotion/aru/confuse.png
潮流没办法
我要上首页!!!
好久不见
见字如晤!
转载一下 🙄
没毛病
咋不做个演示呢,看的心里痒痒的。因为担心自己那里没人玩,就先不折腾了,最近忙…
文章不错支持一下吧
要的