WordPress

Enable Shortcodes In Widgets

Wordpress WordPress shortcodes are great, they allow you to run bits of PHP code from within the text editor by using tags like [ button ] to display a button1.

But there is a problem with shortcodes and you can't run them from within widgets by default.

This isn't too much of a problem if you haven't wrote the widget. But for you WordPress developers that want to use one of your shortcodes in Widgets you need to add the following snippet in your functions.php file.

add_filter('widget_text', 'do_shortcode');

Now you can use these in widgets the same way you would in your posts.

Back to top ^

Join Paulund

  • Get access to 100s of premium tutorials and downloadable content
  • Members content consists of Premium WordPress plugins, CSS packages, jQuery packages, tutorial demo files and templates for 100s of web development tutorials
  • In-depth development tutorials
  • Priority tutorial requests
  • Priority email development support
  • No ads

Here at Paulund you'll find Web Development tutorials and snippets focusing mainly on PHP, WordPress and CSS. Members will get access to premium tutorials that go into more detail about development with these languages. You will also get access to downloadable premium content based on the tutorial.

Join Paulund

Leave a Reply

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