2011-03-03 93 views
0

我喜欢在wordpress中构建整个网站。所有通过网站将有电话号码,地址,一些链接在这里和那里...WordPress ShortTag自定义变量

我喜欢能够定义管理面板中的变量标签,并能够插入到所见即所得的那样:

you can contact us anytime [phone] or visit us here : [address] 

所以改变地址或数字是一个单元!

任何想法,我得到http://wordpress.org/extend/plugins/custom-configs/screenshots/但需要在PHP不shorttag插入...

回答

0

您可以使用PHP使用do_shortcode()功能输出简码值。假设

例子:

<? echo do_shortcode('[phone]'); ?> 

使用你的插件很容易定义的输出定制的内容简码设置

function get_phone($atts, $content = null) { 
return get_config('phone-settings'); 
} 
add_shortcode('phone', 'get_phone'); 

假设在你的插件,你定义了自定义设置与关键phone-settings

+0

创造性的解决方案...看看是否有可能实施轻松......非常感谢 – menardmam 2011-03-03 20:04:56