Blank Dashboard

wordpress安装以后,经常发生Dashboard页空白,进入wordpress后台慢。原因是因为进入后台时会默认加载一些wordpress的新闻RSS。

其中就是把进入后台是要加载的wordpress的新闻注释掉,编辑/wp-admin/index.php,删除line17-line32.。
但有人提出,有时候需要看看新闻,可以即时更新之类的。可在后台的菜单中直接添加了一个“news”项,需要的时候可以去看看,又不影响进入后台速度。
需修改了wp-admin文件夹中的index.php和menu.php两个文件,添加了一个news.php文件。

使用方法:下载我修改后的文件,上传到你服务器的wp-admin文件夹中替换掉原来的index.php和menu.php两个文件即可,同时把news.php文件也复制进去。替换前请把原来的文件备份(虽说没什么必要,但安全第一嘛)。

index.php
注释掉

  1. $rss = @fetch_rss

即可。共有三处。

menu.php

  1. $menu[45] = array(__('Import'), 'import', 'import.php');

后添加

  1. $menu[50] = array(__('News'), 'import', 'news.php');

news.php

  1. < ?php
  2. require_once('admin.php');
  3. $title = __('News');
  4. $parent_file = 'news.php';
  5. require_once('admin-header.php');
  6. require_once (ABSPATH . WPINC . '/rss-functions.php');
  7.  
  8. $today = current_time('mysql', 1);
  9. ?>
  10.  
  11. <div class="wrap">
  12.  
  13. <h2>< ?php _e('News'); ?></h2>
  14.  
  15. < ?php
  16. $rss = @fetch_rss('http://feeds.technorati.com/cosmos/rss/?url='. trailingslashit(get_option('home')) .'&partner=wordpress');
  17. if ( isset($rss->items) && 0 != count($rss->items) ) {
  18. ?>
  19. < ?php } ?>
  20.  
  21. <h3>< ?php _e('Welcome to WordPress'); ?></h3>
  22.  
  23. <p>< ?php _e("Below is the latest news from the official WordPress development blog, click on a title to read the full entry. If you need help with WordPress please see our <a href='http://codex.wordpress.org/'>great documentation or if that doesn't help visit the <a href='http://wordpress.org/support/'>support forums</a>."); ?></p>
  24. < ?php
  25. $rss = @fetch_rss('http://wordpress.org/development/feed/');
  26. if ( isset($rss->items) && 0 != count($rss->items) ) {
  27. ?>
  28. <h3>< ?php _e('WordPress Development Blog'); ?></h3>
  29. < ?php
  30. $rss->items = array_slice($rss->items, 0, 3);
  31. foreach ($rss->items as $item ) {
  32. ?>
  33. <h4><a href='<?php echo wp_filter_kses($item['link']); ?>'>< ?php echo wp_specialchars($item['title']); ?></a> &#8212; < ?php printf(__('%s ago'), human_time_diff(strtotime($item['pubdate'], time() ) ) ); ?></h4>
  34. <p>< ?php echo $item['description']; ?></p>
  35. < ?php
  36.     }
  37. }
  38. ?>
  39.  
  40.  
  41. < ?php
  42. $rss = @fetch_rss('http://planet.wordpress.org/feed/');
  43. if ( isset($rss->items) && 0 != count($rss->items) ) {
  44. ?>
  45. <div id="planetnews">
  46. <h3>< ?php _e('Other WordPress News'); ?> <a href="http://planet.wordpress.org/">< ?php _e('more'); ?> &raquo;</a></h3>
  47. <ul>
  48. < ?php
  49. $rss->items = array_slice($rss->items, 0, 20);
  50. foreach ($rss->items as $item ) {
  51. ?>
  52. <li><a href='<?php echo wp_filter_kses($item['link']); ?>'>< ?php echo wp_specialchars($item['title']); ?></a></li>
  53. < ?php
  54.     }
  55. ?>
  56. </ul>
  57. </div>
  58. < ?php
  59. }
  60. ?>
  61. <div style="clear: both">&nbsp;
  62. <br clear="all" />
  63. </div>
  64. </div>
  65.  
  66. < ?php
  67. require('./admin-footer.php');
  68. ?>

Download Modified files

3 comments so far

  1. [...] 1、使WordPress支持RAR文件上传 2、加快进入Dashboard的速度 3、QuickTag支持coolcode wp-includes/js/quicktags.js 注释掉118到124行,在下面添加如下代码 edButtons[edButtons.length] = [...]

  2. [...] (此文我先把记录下来,在我的电脑上登录后台时一点也不慢,所以测试不出来。网址:http://www.gythialy.net/posts/48#more-48) [...]

  3. [...] 感觉还是不够快,那些新闻我从来都不看,对我来说就是额外的消耗。所以决定干掉它们发现原来的方法已经不可以了。看下源码,现在只要注释掉index-extra.php中的$rss = @fetch_rss就可以了,共有三处。或者直接删掉index.php中的6-13行。 <script type=”text/javascript”> Event.observe( window, ‘load’, dashboard_init, false ); function dashboard_init() {     var update1 = new Ajax.Updater( ‘incominglinks’, ‘index-extra.php?jax=incominglinks’ );     var update2 = new Ajax.Updater( ‘devnews’, ‘index-extra.php?jax=devnews’ );     var update3 = new Ajax.Updater( ‘planetnews’, ‘index-extra.php?jax=planetnews’  ); } </script> [...]

Leave a comment

Please be polite and on topic. Your e-mail will never be published.