WordPress ShortTag Custom Variable
I like to have a whole website build in wordpress. All through the site there will be telephone number, address,开发者_Go百科 some link here and there...
I like to be able to defin variable shorttag in the admin panel somewhere, and be able to insert it in the WYSIWYG like that :
you can contact us anytime [phone] or visit us here : [address]
so changing addres or number is a snap !
any idea, i got http://wordpress.org/extend/plugins/custom-configs/screenshots/ but need to insert in php not shorttag...
You can use the do_shortcode() function to output the shortcode values using php. Assuming that
Example:
<? echo do_shortcode('[phone]'); ?>
Using your plugin is easy to define shortcodes that are outputting the content of a custom setting
function get_phone($atts, $content = null) {
return get_config('phone-settings');
}
add_shortcode('phone', 'get_phone');
Assuming that in your plugins, you have defined a custom settings with the key phone-settings
精彩评论