In previous article I showed How to execute PHP code in Text Widget without using Plugin and this post also deals with similar kind of stuffs.

Shortcodes are piece of reference code which executes specific set of codes when it called.Shortcodes are used it for reducing the code redundancy and to keep things simpler.

Shortcodes feature is implemented on WordPress 2.5.The catch is,shortcodes can be used anywhere inside the contents but not the Widget area.

Many WordPress plugins like YARP supports shortcodes feature but if you want to run these shortcodes in Widget areas like sidebar and footer then add the following line of code in your current theme’s function.php file.

add_filter('widget_text', 'do_shortcode');

Now save the file and To check the functionality add your custom shortcode in a text widget.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badge