Adding shortcode to widgets (Not the text widget)
-
Hi,
It is easy to add shortcode to a text widget by either using a plugin or adding the following to the functions file:
add_filter( ‘widget_text’, ‘shortcode_unautop’ );
add_filter(‘widget_text’, ‘do_shortcode’);This enables you to use a shortcode such as a date and then displaying a current or dynamic date in your widget sidebar.
Is there a way to actually enable shortcode execution for other widgets such as Table of Content Plus and WordPress popular posts by adding a line of code to the functions file?
The text filter only works for a text widget. With the other two plugins, the date does not show up… only the shortcode.
There is nothing wrong with the shortcode, since it works in in the post area.
Can anyone help please?
The topic ‘Adding shortcode to widgets (Not the text widget)’ is closed to new replies.