Lego2012
12/13/2016 - 9:56 AM

Admin and Dashboard - Add a shortcode to widget

Admin and Dashboard - Add a shortcode to widget

<?php
// Do NOT include the opening php tag

<!--
Shortcodes are super-useful because they can just replace what that could be a long piece of code with a little line between square brackets. By default, WordPress widgets aren't enabled to manage shortcodes and they handle them like regular text. But there's the possibility to empower WordPress widgets with the ability to use shortcodes as well thanks to the following piece of code added in the functions.php file: 
  -->

add_filter('widget_text', 'do_shortcode');

<!-- 
This code tweak will make you take advantage of shortcodes on other great tools WordPress comes with: widgets. 
-->