WordPress: Hacking WordPress:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: In very early versions of WordPress, the only way to modify the behavior of WordPress was through a "hack", i.e. by modifying the core files of WordPress. However, since version 1.5, Word...)
 
无编辑摘要
第2行: 第2行:


<span style="color:red"><b>Hacks are not officially supported by WordPress.  Use at your own risk.</b></span>
<span style="color:red"><b>Hacks are not officially supported by WordPress.  Use at your own risk.</b></span>
在很早的WordPress版本中,唯一修改WordPress行为的方法就是通过"hack",如,通过修改WordPress核心文件。尽管如此,1.5版之后,WordPress提供了 [[WordPress:Plugins|插件]]和[[WordPress:Using Themes|主题]]这两个方法修改几乎所有WordPress能做的东西,从功能上来看,hack几乎已经不需要了,自然的也就不推荐使用了。
<span style="color:red"><b>Hack并不被 WordPress正式的支持。使用有一定风险。</b></span>


==Using WordPress Hacks==
==Using WordPress Hacks==
Although hacks are not recommended, and since version 1.5 of WordPress, seldom necessary, for completeness, this article still documents the <tt>my-hacks.php</tt> file, which you can enable and use for "hacks".  Basically, you can put PHP functions and variable definitions into this file (which goes into your root WordPress installation directory), and if you activate it, it will be loaded just before plugins when WordPress starts up.  
Although hacks are not recommended, and since version 1.5 of WordPress, seldom necessary, for completeness, this article still documents the <tt>my-hacks.php</tt> file, which you can enable and use for "hacks".  Basically, you can put PHP functions and variable definitions into this file (which goes into your root WordPress installation directory), and if you activate it, it will be loaded just before plugins when WordPress starts up.  
==使用WordPress Hacks==
尽管不推荐使用hack,而且从WordPress1.5版后WordPress很少需要,但是为了完整性,本文提到了<tt>my-hacks.php</tt>文件,你可以激活并且使用"hack"。  基本上,你可以吧PHP函数和变量定义放到这个文件中去 (这个文件在你的WordPress安装目录根目录下),如果你激活它,它将在WordPress启动时在插件之前被载入。


To activate <tt>my-hacks.php</tt>:
To activate <tt>my-hacks.php</tt>:
第10行: 第17行:
* At the bottom of the page, click the check box for '''<tt>Use legacy my-hacks.php file support</tt>''' to put a check in it.
* At the bottom of the page, click the check box for '''<tt>Use legacy my-hacks.php file support</tt>''' to put a check in it.
* Click Update to save the changed option.
* Click Update to save the changed option.
要激活 <tt>my-hacks.php</tt>:
* 在管理面板中选择'''操作 > Miscellaneous'''.
* 在页面底部,点击'''<tt>Use legacy my-hacks.php file support</tt>'''复选框,选中它。
* 点击更新保存更改。

2008年5月5日 (一) 15:57的版本

In very early versions of WordPress, the only way to modify the behavior of WordPress was through a "hack", i.e. by modifying the core files of WordPress. However, since version 1.5, WordPress has offered both plugin and theme capabilities as mechanisms to modify nearly everything that WordPress does, from looks to functionality, so hacks are seldom necessary any more, and certainly not recommended.

Hacks are not officially supported by WordPress. Use at your own risk.

在很早的WordPress版本中,唯一修改WordPress行为的方法就是通过"hack",如,通过修改WordPress核心文件。尽管如此,1.5版之后,WordPress提供了 插件主题这两个方法修改几乎所有WordPress能做的东西,从功能上来看,hack几乎已经不需要了,自然的也就不推荐使用了。

Hack并不被 WordPress正式的支持。使用有一定风险。

Using WordPress Hacks

Although hacks are not recommended, and since version 1.5 of WordPress, seldom necessary, for completeness, this article still documents the my-hacks.php file, which you can enable and use for "hacks". Basically, you can put PHP functions and variable definitions into this file (which goes into your root WordPress installation directory), and if you activate it, it will be loaded just before plugins when WordPress starts up.

使用WordPress Hacks

尽管不推荐使用hack,而且从WordPress1.5版后WordPress很少需要,但是为了完整性,本文提到了my-hacks.php文件,你可以激活并且使用"hack"。 基本上,你可以吧PHP函数和变量定义放到这个文件中去 (这个文件在你的WordPress安装目录根目录下),如果你激活它,它将在WordPress启动时在插件之前被载入。

To activate my-hacks.php:

  • In the Administration Panel, choose Options > Miscellaneous.
  • At the bottom of the page, click the check box for Use legacy my-hacks.php file support to put a check in it.
  • Click Update to save the changed option.

要激活 my-hacks.php

  • 在管理面板中选择操作 > Miscellaneous.
  • 在页面底部,点击Use legacy my-hacks.php file support复选框,选中它。
  • 点击更新保存更改。