
Categorías:
- Step 1: make your own function inside your plugin
- Step 2: call add_shortcode inside your plugin
- Step 3: use the shortcode in a text widget
Step 1: make your own function inside your plugin
/** * shortcode: site url * @return string */ function wp_home_shortcode() { return WP_HOME; }
Step 2: call add_shortcode inside your plugin
add_shortcode('wp_home','wp_home_shortcode');
Step 3: use the shortcode in a text widget
Just add a Text widget from WordPress administration and type [wp_home] inside the box to get the current url of your WordPress installation