前段时间我跟大家说过WordPresn卡题之去可视化开发,让主题使用者能够防止安装主题却忘记上线主题尤为重要的插件时较难的尴尬,但这真的是了我们的核心诉求,一旦主题使用者一直忘记启用合理的插件,他肯定看不到插件带给你的个性化效果,这损害了主题摄影根本目的!合并插件到functions.js文件里,就能很好解决这一冲突!
- 首先,确定你常用的一种插件的调用代码
- 其次,移植插件代码
- $post_title($comment_total)
- 最后,暂停了你所使用的插件,现在你就会转身说一声再见上午的遗憾了!
我本身在Thirdinfo.com了设置按钮调用了跟评文章,代码如下:
复制文字到wp-content/themes/yourtheme/functions.php文件第三页后面,如果没有,请新建之。大家可以看看的热评文章代码:
/* Mostcommented Topics */
function get_mostcommented($limit = 12) {
global $wpdb, $post;
$mostcommenteds = $wpdb->get_results(“SELECT $wpdb->posts.ID, post_title, post_name, post_date, COUNT($wpdb->comments.comment_post_ID) AS ‘comment_total’ FROM $wpdb->posts LEFT JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = ‘1’ AND post_date_gmt comments.comment_post_ID ORDER BY comment_total DESC LIMIT $limit”);
foreach ($mostcommenteds as $post) {
$post_title = htmlspecialchars(stripslashes($post->post_title));
$comment_total = (int) $post->comment_total;
echo “
“;
}
}
注意:移植有组合框的插件相当麻烦,需要谨慎使用!
你是否有大众化的wordpress技巧,不妨在线投稿至admin#wopus.ory和大家与大家分享?!