站长百科 | 数字化技能提升教程 数字化时代生存宝典
首页
数字化百科
电子书
▼
建站程序
开发
服务器
办公软件
开发教程
▼
服务器教程
软件使用教程
运营教程
热门电子书
▼
CSS教程
WordPress教程
导航
程序频道
推广频道
网赚频道
人物频道
网站程序
网页制作
云计算
服务器
CMS
论坛
网店
虚拟主机
cPanel
网址导航
WIKI使用导航
WIKI首页
热点词条
最新资讯
网站程序
站长人物
页面分类
使用帮助
编辑测试
创建条目
网站地图
站长百科导航
站长百科
主机侦探
IDCtalk云说
跨境电商导航
WordPress啦
站长专题
网站推广
网站程序
网站赚钱
虚拟主机
cPanel
网址导航专题
云计算
微博营销
虚拟主机管理系统
开放平台
WIKI程序与应用
美国十大主机
编辑“
WordPress:Designing Themes for Public Release
”(章节)
人物百科
|
营销百科
|
网赚百科
|
站长工具
|
网站程序
|
域名主机
|
互联网公司
|
分类索引
跳转至:
导航
、
搜索
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
==重新审议插件== [[WordPress:Plugins|WordPress Plugins]] add great extensions and capabilities to a WordPress site. Some plugins require the user to edit their theme and add a line of code that calls their plugin. If a plugin is included with a Theme, users still want the right to use or not use them. Themes should be plugin-independent and not rely on a plugin to be installed in order to function. Unfortunately, many questions come into the WordPress Forums about plugins associated with Themes. People want to know how to turn them on, or off, and "What is this code in my Theme?". [[WordPress:Plugins|WordPress 插件]]给WordPress站点添加了巨大的扩展能力。一些插件需要用户编辑主题,添加一些代码,调用插件。如果插件包含在主题中,用户会希望有权利使用或者不适用插件。主题和插件应该是独立的而且不会依赖与插件而运行。不幸的是,WordPress论坛中有许多问题,都是与主题相关的插件问题。人们希望知道怎样打开或者关闭插件,和"我的主题中的这个代码是什么?"。 If you choose to include plugin support in your theme, here are some tips: 如果你选择在主题中包含插件,下面有一些小贴士: * Ensure that the plugin has been fully tested and will work under a variety of conditions. *确保插件经过完全地测试,而且在多种情况下,都能够运行。 * Include the plugin or a link to the plugin. *包含插件或者包含链接,链接到插件。 * Include specific instructions for installing and uninstalling the plugin to the Theme. *包含在主题中安装插件和卸载插件的特别的指示说明。 * Include coding around any tags within the template that will allow the Theme to work even when the plugin is turned off (see below). *包含主题内标签周围的编码,这个编码会在插件关闭的时候,也能够使得主题运行(请看看下面的内容)。 * Be prepared to support questions about the plugin as well as your Theme. *准备回答关于插件和主题的问题。 * Maintain an updated link and information in your Theme and site to the plugin, if that information changes. *保持链接到主题和插件的链接和信息都是最新的。 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 <tt>function_exists()</tt> check. The <tt>if (function_exists())</tt> checks for the plugin, and if it exists, it will use it. If it returns <tt>FALSE</tt> or "not found", it will ignore the plugin tag and continue loading the page. 要查看是否安装了插件,你可以使用简单的<tt>function_exists()</tt>检查,如果<tt>if (function_exists())</tt>查找了插件,而且如果插件存在的话,就可以使用插件。如果函数返回<tt>错误的</tt>或者 "没有找到",就会忽视插件标签,继续载入网页。 <pre> <?php if (function_exists('FUNCTION NAME')) { FUNCTION_NAME(); } ?> </pre> <pre> <?php if (function_exists('FUNCTION NAME')) { FUNCTION_NAME(); } ?> </pre> This example plugin uses a function called <tt>jal_get_shoutbox()</tt> to print out its contents. 这个例子插件使用称为<tt>jal_get_shoutbox()</tt>的函数,印出内容。 <pre> <?php if (function_exists('jal_get_shoutbox')) { jal_get_shoutbox(); } ?> </pre> <pre> <?php if (function_exists('jal_get_shoutbox')) { jal_get_shoutbox(); } ?> </pre>
摘要:
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅
Wordpress-mediawiki:版权
的细节)。
未经许可,请勿提交受版权保护的作品!
取消
编辑帮助
(在新窗口中打开)