Sat*_*000 4 wordpress wordpress-theming wordpress-plugin
我在worpress头版工作.
我想手动在特定位置向页面添加插件,但我自己将代码添加到页面中.
我基本上想要在特定位置的某个页面中包含一个插件.所以我创建了一个div ...
<div id="plugin-holder">
**Plugin-will-appear-here-with-this-code**
</div>
Run Code Online (Sandbox Code Playgroud)
请问有谁知道怎么做?
谢谢
如果你想要一个插件出现在某个地方,你将会寻找"短代码"功能.
这实际上非常容易编码,在Shortcode API下查看Codex中的示例- 即:
function bartag_func( $atts ) {
// ... do more things here ...
return "text to replace shortcode";
}
add_shortcode( 'bartag', 'bartag_func' );
Run Code Online (Sandbox Code Playgroud)
一旦你调用了这些函数,就可以在代码中使用[bartag],它将运行你的函数并用函数返回的生成文本替换短代码.
这是一个有用的短代码教程:http://www.reallyeffective.co.uk/archives/2009/06/22/how-to-code-your-own-wordpress-shortcode-plugin-tutorial-part-1/
| 归档时间: |
|
| 查看次数: |
20967 次 |
| 最近记录: |