近发现很多收录的文章是显示“重复页面”
下面写出对页面的调整过程
首先删掉了首页的介绍。
原因,所占篇幅过大
减少了随机最新文章和最新评论。
原因,文章和评论更新速度一般。
增加一个随机文章页面
下面这个是代码,供大家参考
<?php
global $wpdb, $tableposts, $randli;
$sql = “SELECT ID, post_title FROM $tableposts WHERE post_status = ‘publish’ “;
$sql .= “AND post_password =” “;
$sql .= “AND post_type <>’page’ “;
$sql .= “ORDER BY RAND() LIMIT 20″;
$randposts = $wpdb->get_results($sql);
$output = ”;
$randli = “0″;
foreach ($randposts as $randpost) {
$post_title = stripslashes($randpost->post_title);
$permalink = get_permalink($randpost->ID);
$randli = $randli+1;
$output .= ‘<ul id=”hpost’ . $randli . ‘”><a href=”‘ . $permalink . ‘” rel=”bookmark” title=”‘;
$output .= $post_title . ‘”>’ . $post_title . ‘</a>’;
$output .= ‘</ul>’;
}
echo $output;
?> 本文转自黄聪博客园博客,原文链接:http://www.cnblogs.com/huangcong/archive/2011/06/24/2088799.html,如需转载请自行联系原作者
global $wpdb, $tableposts, $randli;
$sql = “SELECT ID, post_title FROM $tableposts WHERE post_status = ‘publish’ “;
$sql .= “AND post_password =” “;
$sql .= “AND post_type <>’page’ “;
$sql .= “ORDER BY RAND() LIMIT 20″;
$randposts = $wpdb->get_results($sql);
$output = ”;
$randli = “0″;
foreach ($randposts as $randpost) {
$post_title = stripslashes($randpost->post_title);
$permalink = get_permalink($randpost->ID);
$randli = $randli+1;
$output .= ‘<ul id=”hpost’ . $randli . ‘”><a href=”‘ . $permalink . ‘” rel=”bookmark” title=”‘;
$output .= $post_title . ‘”>’ . $post_title . ‘</a>’;
$output .= ‘</ul>’;
}
echo $output;
?> 本文转自黄聪博客园博客,原文链接:http://www.cnblogs.com/huangcong/archive/2011/06/24/2088799.html,如需转载请自行联系原作者