个人工具
名字空间
变换
操作

WordPress:WordPress Housekeeping

来自站长百科
2008年4月24日 (四) 03:04Xxf3325 (讨论 | 贡献)的版本
跳转到: 导航, 搜索

目录

打扫你的WordPress房间

如同你的房间一样,WordPress也要求一定的家务管理,以保持它顺利工作。这里是一些你应该做的有关规律的预定的基础工作,来保证你的WordPress页面运行顺畅。

更新 WordPress

如果一个新的WordPress版本出现,我们建议你进行更新。这些新版本通常包括新的先进的功能和修正。你不用在新版本出来后立即重新安装。你可以等一段时间。建议查找WordPress更新,并至少每三个月,最多六个月更新一次。查看 WordPress或者WordPress 下载可以获得最新版本。

插件

插件是一个让人兴奋的WordPress功能。它们增加了你的WordPress站点的功能,如,增加了自定义文章列表在站点上添加本地天气预报。

有上百种插件可以使用。测试它们非常有趣,如果你需要它们,而且它们被添加到你的站点或者把东西打乱,尝试不同的插件看看都有什么效果。偶尔的,你也需要做一些有关插件的家务管理了。

更新Plugins

每三到六个月,检查最新版本的插件。这从管理 > 插件 面板中很容易实现. 在左边是链接到插件作者主页或者是插件资源的和文档的栏目,有时还可能是WordPress 插件库. 注意列表中的版本号,点击链接访问页面,查看是否你正在使用最新版本。如果不是,考虑下载和安装最新的版本吧。

删除旧的或者不需要的插件

很多时候插件不适合你的站点或者你不再需要它,但你还把它放在那以防万一.这可能会在你的 管理 > 插件面板中遗留下太多东西,导致你的插件列表拖动起来又长又麻烦。如果放的时间太长,有可能会由于WordPress版本更新导致插件失效。每三到六个月检查一次插件面板,清除你不需要的东西。

插件管理界面|拇指通过访问插件作者的站点开始插件家务管理工作,看看屏幕左边是否有关于如何通过插件面板卸载插件的介绍。一些插件要求添加标签和代码到你的模板文件,有的要求对WordPress 管理文件做出更改. 确定并阅读插件卸载说明,来删除站点上每个这样的更改,这样你的站点在插件关闭时就不会出现错误。

如果没有具体的说明,那就阅读按照说明,查看所做的更改,如果合适并且可能对话把更改改回来。如果你已经使用这个插件很长时间了,你已经把这些更改忘记了并留在了模板文件中。那么仔细的移除它们。

移除插件时,要从 管理 > 插件 面板确认插件处于未激活状态。到站点的wp-content/plugins 文件夹 (通常带有FTP 程序)查找你想要删除的插件的文件名。选择文件并删除。

如果WordPress站点在你的硬盘上也有备份,打开wp-content/plugins文件夹找到你想删除的插件的文件名,选中并删除。这样,如果你不得不恢复或者复制插件文件夹到你的网站上的话,你就不用再看到不想要的插件出现在网页上了。

新插件

WordPress 经常添加新的插件。也许某个插件可以做你现有插件做的工作,但是做的更好呢?也许某个插件可以让你的WordPress 站点受益更大呢?

每三到六个月搜索下网路,或者访问WordPress 插件网站,查看是否有新的可以改进你的站点的插件可用。如果他们替换了你已经安装过的插件的功能, 确定并且按照插件作者的删除说明或者本文中[[WordPress:#Delete Old or Unwanted Plugins| 删除旧的或者不需要的插件]]这部分的小提示进行操作。

主题家务管理

和插件一样,很多使用者喜欢尝试所有不同的WordPress 主题。 一些使用者的 管理 > 界面主题列表中可能有二十或者更多种主题. 如果你正在使用它们,为什么不做些关于主题的家务管理呢?

管理界面面板|thumb想要移除一个主题,查看 管理 > 界面 面板来确认你目前没有使用那种主题。

然后打开网页(使用FTP 程序),查看wp-content/themes/文件夹,找到你想删除的主题。在wp-content/themes/文件夹中把文件夹高亮显示并删除。

如果你把你的WordPress站点保存在硬盘上的话,找到wp-content/themes/文件夹,然后删除不想要的主题文件夹,这样你奖来就不用重新上传了。

如果你正在开发设计你的主题来让它符合你的要求,并且已经进行了一段时间,也许是你该做关于你的主题模板和样式表的家务管理的时候了。

Theme Template Files

While you were designing your template files, you probably added a few things you commented out because they didn't work right or you weren't sure you really needed them, but left them there just in case you wanted them later. If you still don't want them, go through your template files and delete those commented out codes and tags.

主题模板文件

While you were designing your template files, you probably added a few things you commented out because they didn't work right or you weren't sure you really needed them, but left them there just in case you wanted them later. If you still don't want them, go through your template files and delete those commented out codes and tags.

当你在设计你的模板文件时,你可能添加了一些你注释掉的东西,因为它们不能正常工作或者你不确定你是否需要它们,只是放在那防止以后需要用到。如果你真的不需要它们的话,检查你所有的模板文件然后删除这些注释掉的代码和标签。

[[WordPress:#Site Optimizaton|Optimizing your templates and style sheet]] is part of the normal activity of website designers and developers. While you have your template files open, take a moment to clean out some unwanted spaces. Having spaces before a code is fine, but there may be hidden ones after your code lines that just make the file size larger. There also might be three blank lines before some of the code when a single blank line might be all you need to separate some code from the pack. Delete those blank lines, but take care not to remove any spacing that should be left. Familiarity with PHP and HTML helps with this process.

[[WordPress:#Site Optimizaton|优化你的模板和样式表]]是网页开发者和设计者应该做日常工作的的一部分. 当你打开模板文件时,花点时间清楚不需要的空格。在代码前加上空格没问题,但是在你的代码后有可能隐藏着其他空格,这会让你的文件尺寸变大。同样还有可能在某写代码之前,一行开始的时候有三行空行,也许你只是想分开某些代码。删除这些空行,但是注意不要删除一些应该保留的空格。精通PHP和 HTML 对此有所帮助。


Cleaning the Style Sheet

Just as with your template files, it may be time to do a little housekeeping on your styles.css file in your Theme folder. There is [[WordPress:#Site Optimizaton|more information on optimizing your style sheet]] below, but start first by cleaning out the unwanted stuff in your style sheet.

清理样式表

和模板文件一样, 也许是时候对你主题文件夹中的styles.css文件做一些家务管理了。下边有[[WordPress:#Site Optimizaton|更多有关优化样式表的信息]],但是首先从清除样式表中不需要的部分开始。

Look for comments you've made to remind you of the things you did and changed. Do you still need them to remind you of modifications you made, or can they be deleted?

找到你所做的提醒你自己做了哪些和改变了什么的注释 ,你还需要它们提醒你修改的东西还是可以被删除了?

Look for triple space lines between style sections and delete those down to one blank line to clean up your file size.

Is your style sheet a jumble of style references? Is it grouped alphabetically and are you tired of hunting through lines of code to find everything in your core structure (header, content, sidebar, footer) when it might be more convenient to group these together? Or maybe you have it grouped by section and similarity and you want it sorted alphabetically. Either way, it might be time to do a little housekeeping and arrange your style sheet the way that works best for your needs.

在样式之间找到三行一组的空行,然后删除,只留下一行来缩小文件尺寸。

你的样式表只是一个样式参数的混了集合吗?它是按字母排序的?在可以更方便的组织这些代码的情况下,你已经对从主要代码(header, content, sidebar, footer)一行行的找东西感到厌倦了吗?或者你把它们按照类别和相似程度组织好了,但是想让它们按字母顺序排列。不管哪种方法,你都需要做一些家务管理,用最好的方法按照你的意愿安排你的样式表。

Get a New Theme

Tired of your old theme's look? Maybe it's time to do a little presentation housekeeping and change the look of your WordPress site. With the addition of Themes in WordPress v1.5, changing your site's look is easy.

获得新的主题

对旧的主题外观感到厌倦了?可能到了做些家务管理来改变WordPress站点的外观的时候了。在 WordPress v1.5 主题的新增功能的帮助下, 更改站点外观是很容易的.

Check out the various resources for WordPress Themes. If you find one you like, download it and install it according to the theme author's instructions and then activate it from the Administration > Presentation Panel.

查看WordPress 主题的多种资源,如果你找到你喜欢的,下载下来并按照作者的说明安装,然后从管理 > 界面面板中激活使用。

Don't worry, your old theme will still be there. Test drive the new one for a while. You can always go back to the old one. If you are really determined to turn your theme housekeeping efforts into some serious work, check out the article on WordPress:Theme Development to create your own unique theme.

不用担心,以前的主题依然存在。测试运行一会新的主题。你可以随时用回旧的主题。如果你确定要把你的主题家务管理结果变成一些严肃的工作来做,查看有关主题开发来创建你的独一无二的主题。

Unwanted Images

Many users upload a lot of graphics to their site that they end up never using. If you find yourself with a lot of unused graphics and images, consider going through them and cleaning house by deleting them. Double check that they are also removed from your hard drive WordPress folder, so you don't add them back in the future.

不要的图片

很多用户上传了许多图片,但是从没使用过。如果你发现你有很多没有用过的图片,可以考虑检查并清理掉它们。再次检查它们同样从硬盘上的WordPress文件夹中删除掉了,这样你将来就不会再把它们添加回去了。

If you aren't sure you will never need them again, but you aren't using them now and want to remove them from your site if server site space is limited, move them to a folder in your hard drive WordPress folder called backupimages or something similar and store them there, just in case.

如果你不确定你是否不会再用到它们,但是现在不用,并且服务器空间还有限制,所以想从网站上删除, 那就把它们移动到另外一个在硬盘上的叫做backupimages 的WordPress文件夹中,或者其他类似的文件夹储存,以防万一

Site Optimization

If you are using a WordPress Theme you haven't modified, you shouldn't have to worry about optimizing your website. Still, it might help. Site optimization means creating a "lean and mean" website that loads fast, is easy on the bandwidth, validates, and meets web standards.

站点优化

如果你在使用一个你没有修改过的WordPress主题,你不用担心优化网页。当然,它可能会对你有帮助。站点优化意味着建立"言简意赅"的载入迅速,适合带宽,验证并达到网页标准的网页。

WordPress stresses that code and style files should validate and be laid out with a lot of tabs so they are easy to read. The World Wide Web Consortium and the Web Standards Organization stresses that all web page code be compliant with their standards. If you are going to get into this, you should familiarize yourself with the most basic of these standards.

WordPress强调代码和样式文件应该有效,使用大量标签设计,这样它们容易阅读。万维网联盟网页标准组织 强调所有的网页代码都适应它们的标准。如果你正打算涉及这方面,你应该熟悉这些标准的基础.

One of those standards is to present a clean and optimized style sheet and XHTML code. We've covered some of the housekeeping cleaning chores associated with WordPress files and functions, but if you really want to streamline your site's code, take it a step further and look into your site optimization options.

那些标准之一就是显示一个干净和优化的样式表和XHTML 代码。我们再WordPress文件和函数的帮助下,涵盖了一些家务管理的清理杂务,但是如果你希望让你的站点代码更优秀,就更进一步来看看站点优化操作吧。

Basically, total site optimization means validating your site's HTML and CSS, testing the site's design across browsers, ensuring web standards are met, including standards for accessibility - but let's start with some simple cleaning.

基本上,全站优化意味着检验站点的HTML 和CSS,通过浏览器测试站点的设计,保证网页达到标准,包括可能达到的标准-让我们从一些简单的清理开始吧。

Every space, character, and bit in your code and style sheets add up to bytes. That sentence came to about 64 bytes. Each byte of information adds up, and the larger they are, the longer they take to load. Do yourself and your users a favor by keeping your file sizes to a minimum. So where do all these bandwidth wasters hide?

代码和样式表中的每个空格,字符,和位最终都会合计为字节.这个句子达到大约64字节,每个字节的信息相加,尺寸就越大,载入时间就越长。通过保持文件尺寸为最小的方法帮助你自己和你的用户。这样所有的浪费带宽的东西还能往哪里藏呢?

If you have set your code to look pretty with lots of indents, have you checked to see if there are any TAB codes at the end of the line before the line break? In some themes, there tend to be a lot of those. You don't need a TAB before a line break, only after, but somehow, these sneak into the code.

如果你设置了你的代码,使用很多缩进以看起来更漂亮,那么你查看了是否在换行前行末尾有任何TAB代码?在一些主题中,会有很多。在换行前不需要TAB,只在换行后才需要,但不知道什么原因,这些总是偷偷隐藏在代码中。

Using spaces to line up code adds to the size. A TAB is considered one character in most editors, but the five spaces that copy the TAB indent takes up five characters. Using double spaces instead of single spaces in your code and styles adds up, too.

使用空格来排列代码让文件尺寸增加。TAB在很多编辑器中被认为是一个字符,但是从TAB复制过来的五个空格缩进占据了五个字符。在代码和样式中使用双空格代替单空格也会增加尺寸。

Using a good search and replace capable text editor, you can quickly clean these up, making your styles and code optimized for fast loading.

使用好的搜索并替代功能的文本编辑器,你可以很快的清理这些东西,让你的样式和代码优化,更快的载入。

There are a lot of ways of optimizing your code and styles, and here are some resources for more information on creating lean and mean code:

有很多种方法优化你的代码和样式,这里是一些资源,可以找到更多的关于建立言简意赅的代码的信息。

Optimization Resources Code

最优化资源代码

Speeding Up Your Site

给站点提速

Maintenance Schedule

In the article, Lessons: WordPress Site Maintenance, we cover website maintenance, but take a moment now to go through this list of WordPress housekeeping chores and add them to your calendar so you can clean up your site on a regular basis, keeping your WordPress site a lean and clean site to visit.

维护计划

课程: WordPress站点维护这篇文章中, 我们提到了网站维护,现在花点时间来看这个WordPress 家务管理列表并把它们加入到你的日程表中,这样你可以在规律的基础上清理你的站点,保证你的站点是一个简洁并且内容丰富的网站。