1. Home
  2. Knowledge Base
  3. Widgets and Plugin
  4. Advanced Widgets
  5. Widget Shortcodes in WordPress Theme/Template files

Widget Shortcodes in WordPress Theme/Template files

WordPress will not automatically convert shortcodes that are placed directly in template files.

However, you can take advantage of the do_shortcode(); function to get around this limitation.

e.g. instead of this shortcode
[codewp][mbb_widget id=”MBBv3_SearchForm”][/codewp]
use this PHP code
[codenone]<?php echo do_shortcode(‘[mbb_widget id=”MBBv3_SearchForm”]’); ?>[/codenone]

Updated on February 26, 2022

Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support