Title: Adding shortcode to widgets (Not the text widget)
Last modified: August 3, 2017

---

# Adding shortcode to widgets (Not the text widget)

 *  [jamezon](https://wordpress.org/support/users/jamezon/)
 * (@jamezon)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/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?
    -  This topic was modified 8 years, 9 months ago by [jamezon](https://wordpress.org/support/users/jamezon/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [8 years, 9 months ago](https://wordpress.org/support/topic/adding-shortcode-to-widgets-not-the-text-widget/#post-9378334)
 * You’d have to ask the authors of those plugins about that — whether they have
   a hook that would allow you to do that.
 *  Thread Starter [jamezon](https://wordpress.org/support/users/jamezon/)
 * (@jamezon)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/adding-shortcode-to-widgets-not-the-text-widget/#post-9378338)
 * Thanks Steve.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding shortcode to widgets (Not the text widget)’ is closed to new replies.

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [jamezon](https://wordpress.org/support/users/jamezon/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/adding-shortcode-to-widgets-not-the-text-widget/#post-9378338)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
