Hi,
有钱终成眷属
没钱亲眼目睹

NANA主题站长推荐小工具代码缺陷修复

本文最后更新于2021年4月1日,已超过 3 年没有更新,如果文章内容或图片资源失效,请留言反馈,我会及时处理,谢谢!

懿古今的NANA主题用了不到一个月时间,最近使用中发现站长推荐有点问题,表现为当取消站长推荐后,侧边栏站长推荐栏里还是显示已取消推荐的文章。

站长推荐使用的字段名称为hot,保存在数据库的postmeta表里,当我们勾选站长推荐时,postmeta表里的hot值为


当我们取消站长推荐时,hot值为

接着,打开主题下inc/functions/widgets.php文件的第242行,语句为


<?php query_posts( array ( 'meta_key' => 'hot', 'showposts' => $number, 'orderby' => 'rand', 'ignore_sticky_posts' => 1 ) ); while ( have_posts() ) : the_post(); ?>

然后,我在里面又加了一个条件,改为:

<?php query_posts( array ( 'meta_key' => 'hot','meta_value' => 'true','showposts' => $number, 'orderby' => 'rand', 'ignore_sticky_posts' => 1 ) ); while ( have_posts() ) : the_post(); ?>

经过测试,问题解决了。希望对大家有所帮助,文笔有限望见谅~~~

赞(0)
未经允许不得转载:伊阳博客 » NANA主题站长推荐小工具代码缺陷修复

留言 抢沙发