RSS
热门关键字:

dashboard无法正常使用的解决方案

来源: 作者: 时间:2006-10-20 Tag: 点击:
即使是以前,我也很上直接进入管理界面的dashboard页,因为这个页面实在是太慢了。因为每次打开它,wp后台都会向Technorati和wordpress站点请求一些内容,而我这里跟国外的连接比较慢,导致每次不小心点到dashboard都要等待很长时间。现在,Technorati被封,直接导致dashboard不但速度更慢,而且无法正常浏览。

不过解决方案很简单,只要删掉向Technorati和wordpress站点请求内容的代码即可。Google Group上wordpress版面冰古同学(这可是大牛,前面blogbus备份数据转换程序也是他给出的)给出了修改后的代码,我们可以直接拿过来用。代码可以到论坛上去找,方便起见,在这里也贴一个(附在最后)。修改后进入管理员界面很快。

使用方法: 下载上面给出的index.php.txt后,去掉.txt后缀,覆盖掉/wp-admin/index.php即可。注意使用前备份原来文件。

<?php
require_once('admin.php');
$title = __('Dashboard');
require_once('admin-header.php');
require_once (ABSPATH . WPINC . '/rss-functions.php');

$today = current_time('mysql', 1);
?>


<div class="wrap">


<h2><?php _e('Dashboard'); ?></h2>


<div id="zeitgeist">
<h2><?php _e('Latest Activity'); ?></h2>


<?php
$comments = $wpdb->get_results("SELECT comment_author,
comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments
WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 5");
$numcomments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments
WHERE comment_approved = '0'");


if ( $comments || $numcomments ) :
?>
<div>
<h3><?php _e('Comments'); ?> <a href="edit-comments.php" title="<?php
_e('More comments...'); ?>">»</a></h3>


<?php if ( $numcomments ) : ?>
<p><strong><a href="moderation.php"><?php echo sprintf(__('Comments in
moderation (%s)'), number_format($numcomments) ); ?>
»</a></strong></p>
<?php endif; ?>
</div>


<ul>
<?php
if ( $comments ) {
foreach ($comments as $comment) {
        echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(),
'<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' .
$comment->comment_ID . '">' . get_the_title($comment->comment_post_ID)
. '</a>');
        edit_comment_link(__("Edit"), ' <small>(', ')</small>');
        echo '</li>';


}
}


?>
</ul>

<?php endif; ?>


<?php
if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM
$wpdb->posts WHERE post_status = 'publish' AND post_date_gmt < '$today'
ORDER BY post_date DESC LIMIT 5") ) :
?>
<div>
<h3><?php _e('Posts'); ?> <a href="edit.php" title="<?php _e('More
posts...'); ?>">»</a></h3>
<ul>
<?php
foreach ($recentposts as $post) {
        if ($post->post_title == '')
                $post->post_title = sprintf(__('Post #%s'), $post->ID);
        echo "<li><a href='post.php?action=edit&post=$post->ID'>";
        the_title();
        echo '</a></li>';


}


?>
</ul>
</div>
<?php endif; ?>

<?php
if ( $scheduled = $wpdb->get_results("SELECT ID, post_title,
post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND
post_date_gmt > '$today' ORDER BY post_date ASC") ) :
?>
<div>
<h3><?php _e('Scheduled Entries:') ?></h3>
<ul>
<?php
foreach ($scheduled as $post) {
        if ($post->post_title == '')
                $post->post_title = sprintf(__('Post #%s'), $post->ID);
        echo "<li>" . sprintf(__('%1$s in %2$s'), "<a
href='post.php?action=edit&post=$post->ID' title='" . __('Edit this
post') . "'>$post->post_title</a>", human_time_diff(
current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT')
))  . "</li>";


}


?>
</ul>
</div>
<?php endif; ?>

<div>
<h3><?php _e('Blog Stats'); ?></h3>
<?php
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE
post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts);


$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE
comment_approved = '1'");
if (0 < $numcomms) $numcomms = number_format($numcomms);


$numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
if (0 < $numcats) $numcats = number_format($numcats);
?>
<p><?php printf(__('There are currently %1$s <a href="%2$s"
title="Posts">posts</a> and %3$s <a href="%4$s"
title="Comments">comments</a>, contained within %5$s <a href="%6$s"
title="categories">categories</a>.'), $numposts, 'edit.php',
$numcomms, 'edit-comments.php', $numcats, 'categories.php'); ?></p>
</div>


<?php do_action('activity_box_end'); ?>
</div>


<h3><?php _e('Welcome to WordPress'); ?></h3>


<p><?php _e('Use these links to get started:'); ?></p>


<ul>
<li><a href="post.php"><?php _e('Write a post'); ?></a></li>
<li><a href="profile.php"><?php _e('Update your profile or change your
password'); ?></a></li>
<li><a href="link-add.php"><?php _e('Add a link to your blogroll');
?></a></li>
<li><a href="themes.php"><?php _e('Change your site’s look or
theme'); ?></a></li>
</ul>


<div style="clear: both"> 
<br clear="all" />
</div>
</div>


<?php
require('./admin-footer.php');
?>

最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册