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

WordPress:Managing Plugins

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

目录

插件是程序脚本的cool位,可以给你的博客添加额外的功能。它们给你的博客添加新的添加物,会提升已有的功能或者给你的站点添加新的功能

插件扩展了WordPress的功能。WordPress的大多数用户不需要插件,或者只需要几个插件,例如处理评论中的垃圾广告和自定义文章列表的插件。其它的用户喜欢插件提供的不同的选项,例如频繁更新的天气预报,文章字数统计,评级系统,以及更多的。因为插件的选择是很广的,根据用户的需求选择,插件没有纳入WordPress的核心。

WordPress插件是由志愿者设计的并且免费提供给公众。以下所列出的插件的原始资料已经被完全地测试了,并且被认为是"安全的"。但是要记住,插件是作者和用户的职责,而且它们会随着WordPress的壮大和发展而不断地发展。 如果你想发展你自己的插件,在插件资源中有全面的资源列表。

找到插件

插件中有WordPress插件列表,和对其它的插件库的链接。

插件兼容性

WordPress 插件兼容性 指出插件与不同的WordPress版本兼容。

安装插件

right|thumb|WordPress 插件面板WordPress提供简单容易的方法来给你的博客添加插件。在管理面板,点击插件标签。你一旦上传了一个插件到你的WordPress插件目录上,在插件管理页面上将它激活,休息一下,看看你的插件是怎样运行的。

并不是所有的插件安装起来都很简单,但是WordPress作者和开发者,使这个过程尽可能地简单。下面还有一些关于安装插件的更详细的信息,以及一些在你安装之前你需要知道的一些东西。

在你安装之前你需要了解的事

There are a few things you need to know before you begin to install WordPress Plugins. 在你开始安装WordPress插件之前,你需要了解一些事情。

Know before you install. 
Read through the readme.txt files and web pages, as well as any comments regarding the Plugin on an author's website, before you install. The more you know before you install, the easier the process should be.

;安装前需要知道的。:在安装之前,读一遍readme.txt文件和网页,以及作者的网站上任何有关插件的评论。你安装之前知道的越多,安装的过程就会越简单。

Plugins require downloading and uploading to install. 
You must be familiar with how to download and upload files and how to use FTP, if required.

;插件需要下载和上传来安装:如果需要的话,你必须熟悉怎样下载和上传文件以及怎样使用FTP.

Plugins may require modifying WordPress files and templates. 
Familiarity with PHP, HTML, CSS, and CHMOD may be necessary.

;插件也许需要更改WordPress文件和模板。:熟悉PHP, HTML, CSS, 和CHMOD也许是必须的。

Record modifications. 
If you make any changes to the WordPress files or templates, make a note of it in the code by using comments before and after the changes, and in a text file saved to your site and on your desktop to remind you of any additions or modifications to your default files or templates. This will help you repeat these in the future if there are any problems with your site.

;记录更改的内容。:如果你对WordPress文件或者模板做了一些更改,通过使用更改前或者后的评论,在代码上记录更改的内容,将文本文件保存到你的站点和你的桌面上,以提醒你,对你的默认文件或者模板做了哪些的更改。如果以后你的站点出了什么问题,这个会帮助你重复这个。

Make frequent backups! 
Some Plugins work independently of your blog's content and files, just adding a little something special to the page. Others require modification of content and files, including changes to your database. Before installing any plugin that will make dramatic changes, backup your database and files.

:频繁地做文件备份!:有些插件运行时,独立于你的博客的内容和文件,只是给你的网页添加一点特殊的东西。其它的插件需要更改你的内容和文件,包括更改你的数据库。在安装任何会引起大的变化的插件之前,给你的数据库和文件备份。

There are several versions of WordPress currently available, and different Plugins available for the different versions. Be sure and read through the information thoroughly to determine if the Plugin will work with your version, or check Wordpress:Plugins/Plugin_Compatibility. If not, consider upgrading. 目前有几个不同版本的WordPress,而且不同的插件需要不同的版本。确定并且通读一遍信息以确定插件是否能在你的版本上运行,或者查看一下Wordpress:Plugins/插件兼容性。如果不能的话,考虑一下升级

Plugin Installation

插件安装

To install a plugin, the following are the general directions to follow. Be sure and follow the specific instructions provided by the Plugin author. Remember: BACKUP - just in case. 安装一个插件,以下是一个需要遵循的总体指导。确定遵循了插件作者的特别的指导。记住:文件备份-以防万一。

  1. Read through the "readme" file thoroughly that usually accompanies a plugin, or the website article from where you found the plugin. It is often helpful to print out the instructions so you can check off the installation steps as you complete them.
  2. 通读一遍"readme"文件,这个文件通常跟着一个插件,或者通读你找到插件的站点上的文章。印出指示说明通常有用,这样你在完成了安装步骤之后,你可以核对一下安装步骤。
  1. Upload the plugin to the wp-content/plugins folder in your WordPress directory online.
  2. 上传插件到你的WordPress在线目录的wp-content/plugins文件夹上。
  3. Make any changes to templates or files as required by the Plugin instructions including adding Plugin template tags.
  4. 根据插件说明,更改模板或者文件,包括添加插件模板标签。
  5. Activate the Plugin:
  6. 激活插件:
    1. Access the Plugin Panel in your Wordpress:Administration Panels
    2. 在你的管理面板上访问插件面板
    3. Scroll down through the list of Plugins to find the newly installed Plugin (if not visible, start from the beginning to check to see if you followed the instructions properly and uploaded the file correctly).
    4. 向下滚动到插件列表找到最新的安装的插件(如果看不到,从头开始,看看你有没有适当地遵循指示,正确地下载了文件。
    5. Click on the Activate link to turn the Plugin on.
    6. 点击激活链接,打开插件。
  7. Continue making any modifications necessary from the "readme" file instructions to make the plugin's actions meet your needs.
  1. 继续根据"readme"文件的说明来做一些必要的更改,使插件的运行符合你的需求。

Hiding Plugins When Deactivated

插件在未激活的状态下,使其隐藏

Some plugins feature tags inside of the template files. If the plugin is not activated, it will "break" the Theme and it may report errors or fail to load. It is therefore imperative to prevent the plugin from being detected in case it is turned off.

有的插件的标签在模板文件的里面。如果插件没有被激活,它会"削弱"主题,或者报告错误或者不能载入。因此,在万一插件关闭的时候,有必要隐藏插件。

To detect if a plugin is installed, you can use a simple function_exists() check. The if (function_exists()) checks for the plugin, and if it exists, it will use it. If it returns FALSE or "not found", it will ignore the plugin tag and continue loading the page.

查看插件是否安装了,你可以使用一个简单的function_exists() 检查。if (function_exists())检查插件,而且如果它存在的话,它会使用它。如果它返回了FALSE 或者 "没有找到",它会不管插件标签并且继续地载入网页。

<?php
if (function_exists('FUNCTION NAME')) {
  FUNCTION_NAME();
}
?>

This example plugin uses a function called jal_get_shoutbox() to print out its contents.

<?php
if (function_exists('jal_get_shoutbox')) {
  jal_get_shoutbox();
}
?>




<?php
if (function_exists('FUNCTION NAME')) {
  FUNCTION_NAME();
}
?>

This example plugin uses a function called jal_get_shoutbox() to print out its contents.

<?php
if (function_exists('jal_get_shoutbox')) {
  jal_get_shoutbox();
}
?>


Troubleshooting Plugins

发现并修理插件故障

If you are experiencing problems with a plugin you installed or one that stopped working after upgrading, the following are the steps you need to take to troubleshoot the plugin:

如果你遇到了安装的插件的使用麻烦,或者在升级后,插件不运行了,以下是一些你需要采取的步骤来解决和修理插件故障:

  1. Check that you have followed the plugin author's instructions to the letter.
  2. 核实一下你是否严格地按照了插件作者的指示。
  3. Check that any plugin tags or usage within your template files are correct, spelled right, and placed in the appropriate place, i.e., within the WordPress Loop or outside of it.
  4. 查看一下你的模板文件中任何的插件标签或者使用是正确的,拼写是正确的,并且放在了适当的位置,例如,在WordPress Loop里面或者外面。
  1. Check that you uploaded the file to the plugins folder under wp-content. If you are uploading a new version to replace the old, delete the old version prior to uploading the new one.
  2. 核实你将文件上传到wp-content下的插件文件夹中。如果你上传一个新的版本来代替老的版本,在上传新版本之前,将老的版本删除。
  3. Check that the plugin has been activated in your Plugin Panel of your Administration Panels.
  4. 核实一下插件在你的管理面板上的插件面板中激活了。
  5. Deactivate and re-activate the plugin to see if this makes it work.
  6. 使插件处于待发状态再重新地激活插件,看看这样能否使插件运行。
  7. Visit the plugin author's website, typically linked from the Plugin Panel, and look to see if someone else is having the same trouble and an answer has been posted, or a new version released.
  8. 访问插件作者的网站,特别是链接在插件面板上的,看看是不是其他人也有同样的问题,同时看看答案有没有粘贴上去,或者有没有发行一个新的插件版本。
  9. Contact the plugin author directly via their website or email requesting assistance.
  10. 通过插件作者的网站或者邮件请求协助,直接地联系插件的作者。
  11. Search the Internet for the name of the plugin and the trouble you are having as someone else might have had the same problem and found a fix and posted it on their site.
  12. 在网上搜索一下你使用的插件名和你遇到的麻烦,因为其他的什么人可能遇到了同样的麻烦,并且找到了一个解决办法,而且将它发表在他们的站点上。
  13. Visit the WordPress Support Forum and post a clear question about the plugin and the problem you are having and you may get an answer from someone familiar with the plugin.
  14. 访问WordPress 支持论坛发表一个关于你使用插件时遇到的麻烦的清除的问题,你可能从某个熟悉这个插件的人那儿得到一个答案。
  15. If the problem persists and you cannot seem to solve it, check to see if there are any similar plugins that you can try instead.
  16. 如果问题仍然存在而且似乎你不能解决,查看一下有没有什么类似的插件,你可以替换着使用一下。

Upgrading WordPress May Break Plugins

升级 WordPress 可能削弱插件

Some plugins may become outdated and no longer work with the newer version of WordPress. If you have issues after activating a plugin, deactivate it and visit the Plugin's website to see if a newer version is available.

一些插件对于新的版本的WordPress, 可能过时了,不再运行了。如果你激活了一个插件后,遇到了问题,使插件处于待发状态,并且访问插件站点,看看有没有一个更新的版本。 Many plugin authors will upgrade their plugins to accommodate the newer version, but some either won't, or their plugin becomes obsolete with the improvements in WordPress.

许多插件作者升级他们的插件来适应更新的版本,有的不,或者他们的插件在WordPress的改进后,变得过时了。

Plugin Management

插件管理

Plugins are managed from the Plugins Panel in the Wordpress:Administration Panels of your WordPress site. All plugins listed on this screen are found in your wp-content/plugins directory. Each plugin has a description of what it does, an author and website to refer to, and a version number. If you do not see the plugin on the list, it is because it is missing the "header": 插件在你的WordPress站点上的管理面板上的插件面板上管理。所有列在你的屏面上的插件都可以在你的wp-content/plugins目录中找到。每个插件都有一个关于它是做什么的描述,作者和查阅的网站,以及一个版本数字。如果你在列表上没有看见插件,那是因为它丢失了"标题":

<?php
/*
Plugin Name: Magic Plugin
Plugin URI: http://example.com/magic-plugin
Description: Magic Plugin performs magic
Version: 2.3
Author: Mr. Magic
Author URI: http://example.com/
*/




<?php
/*
插件名: Magic Plugin
插件 URI: http://example.com/magic-plugin
描述: Magic Plugin performs magic
版本: 2.3
作者: Mr. Magic
作者 URI: http://example.com/
*/


You can add this information yourself by opening the plugin in a text editor and adding the above "comment", changing the information as follows:

通过一个文字编辑器你可以打开插件,自己添加信息,通过添加以上的"评论",将信息改为以下的:

Plugin 
Shows the plugin's name, and links to the plugin's website if one is provided. Plugins listed in bold are currently active.

;插件:显示插件名,如果有提供的话,显示插件站点的链接。粗体列出的插件,当前是激活的。

Version 
The version number of the plugin.

;版本:插件的版本数字。

Description 
The author's description of what the plugin does and who authored the Plugin.

;描述:作者的描述关于这个插件的用处以及插件是由谁创作的。

Action 
Allows you to activate, deactive, or edit the plugin.

;激活:允许你激活,或者不激活。或者编辑插件。

New version available 
If a newer version of a Plugin is available in the WordPress Plugin repository a message will display along with a link to the location to download that new version.

;可以得到的新的版本:如果WordPress 插件库中有一个插件的新版本,会显示一个消息和一个链接到新版本的下载地址。

Activation and Deactivation

激活和不激活

If your plugin requires changes to the WordPress code or your template files, you will need to enact or reverse those changes each time you activate or deactivate your plugin. Failing to do this will likely result in errors. There is also a link provided below the list of Plugins that allows you to Deactivate All Plugins. 如果你的插件需要对WordPress代码或者你的模板文件做一些更改,每次你激活或者不激活插件的时候,你就需要做出或者不做出这些改变。没有这样做的话,就可能导致错误。在插件列表下也有一个链接,允许你不激活所有的插件。

Uninstalling Plugins

卸载插件

While Plugins are very useful, some Plugins just don't meet your needs, or you've stopped using them for some reason, or they just don't work. After deactivating the Plugin stops the Plugin's behavior, they tend to pile up in your Plugins panel, making your plugin list long and cumbersome to scroll through. If left there long enough, they might become obsolete with the new WordPress versions and cause problems if you decide to use them in the future.

虽然插件非常地有用,有些插件可能不符合你的需求,或者你因为某种原因而停止使用它们,或者仅仅因为它们不运行了。在使插件处于待发状态之后,插件停止了运行,它们倾向与在你的插件面板上堆积,滚动你的插件列表时,又长,有麻烦。如果将它放在那儿的时间过长,它们可能对于新的WordPress来讲,就过时了,如果你在以后准备使用它,它可能还会造成麻烦。

Plugin Admin Screen|thumbBegin your Plugins housekeeping by visiting the plugin author's site to see if there are instructions on how to uninstall the plugin via the Plugins panel on the left side of the screen. Some plugins require adding tags and code to your Template files while others require modification of the WordPress administration files. Be sure and read through the plugin's uninstall instructions to remove each of these modifications so your site will not have errors when the plugin is turned off.

Plugin Admin Screen|thumb通过访问插件作者的站点看看有没有指示说明关于怎样通过屏面左边的插件面板来卸载插件,以此来开始管理你的插件。有的插件需要给你的模板文件添加标签和代码,而其它的需要更改WordPress管理文件。确定通读了一遍插件的卸载指示说明,移动每个更改,这样关闭插件时,你的站点也不会发送错误。


If no specific instructions for uninstalling exist, then read through the installation instructions to check for modifications, if applicable, and reverse their changes, if implemented. If it has been a long time since you used this plugin, you still might have left its modifications in your template files and forgotten them. Carefully remove them.

如果不存在卸载的特别的指示说明,通读一下安装说明来查看一下更改,如果使用,如果可执行的话,扭转它们的变化。如果你使用这个插件已经有很长时间了,你仍有可能在你的模板文件中保存了更改,而且你忘记了这件事。仔细地将它们清除。

To remove a plugin, make sure the plugin is deactivated from the Plugins panel. Go to your website's wp-content/plugins folder (usually with an FTP program) and look for the file name of the plugin you want to remove. Select the file name and delete it. 移除一个插件,要确保插件在插件面板中没有激活。转到你的网站的wp-content/plugins文件夹(通常有一个FTP程序),找你想要移除的插件的文件名。选上文件名并且将它删除。

If have your WordPress site on your hard drive, open the wp-content/plugins folder on your site and find the file name of the plugin you want to delete, select it and delete it. This way, if you have to restore or copy your Plugin folder to your website, you won't restore the unwanted plugin on your site. 如果你的WordPress站点在你的硬盘上,打开你的站点上的wp-content/plugins文件夹,并且找到你想要删除的插件名,选中它,并且将它删除。这样,如果你想要重建或者复制你的插件 文件夹到你的站点上,你不会重新不必要的插件到你的站点上。

Plugin Dependencies

插件依靠

If your theme relies on one or more plugins in order to correctly function, you may be interested in Jonathan Leighton's article explaining how to set up plugin dependencies.

如果你的主题依靠于一个或者更多的插件来正确的运行,你对Jonathan Leighton的文章解释怎样设置一个插件依赖可能会感兴趣。

Developing Your Own Plugins

发展你自己的插件

Once you start using WordPress Plugins, you sometimes wonder how you ever got along without them. If you have knowledge of PHP, you can develop your own plugins, and there is a comprehensive list of resources at Wordpress:Plugin Resources to get you started.

一旦你开始使用了WordPress插件,有时候,你不知道没有插件时,你该怎么办。如果你有PHP的相关知识,你可以发展自己的插件,在插件资源上有一个全面的资源列表,可以帮助你开始发展插件。

留言