• 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 (specifically for a dynamic or current date) for Table of Contents Plus?

    There is nothing wrong with the shortcode, since it works in in the post area when I add it to the headings and allow the table of contents to display in the post area.

    The problem is that I show the table of contents in the sidebar and when I do, the actual shortcode is showing and not the date.

    Wordpress does not support shortcodes in widgets or the sidebar as far as I know, unless you add a filter.

    Can anyone help please?

The topic ‘Adding shortcode to TOC +’ is closed to new replies.