• Resolved rdellconsulting

    (@rdellconsulting)


    Having just discovered this extension to your wonderful plugin (I just donated!), the simple shortcode:
    [table-cell id=1 cell=A1 /]
    works on a Page, but doesn’t work in the WP Text Widget in a sidebar.

    What did I miss?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post (and for the donation!), and sorry for the trouble.

    That’s correct, as WordPress does not run Shortcodes in text widgets in general. TablePress works around this for the [table] Shortcode, and it’s easy to do the same for the Extension. Just add this to the end of the Extension’s .php file:

    if ( ! is_admin() ) {
    	add_filter( 'widget_text', 'table_single_cell_widget_text_filter' );
    }
    function table_single_cell_widget_text_filter( $content ) {
    	global $shortcode_tags;
    	$orig_shortcode_tags = $shortcode_tags;
    	$shortcode_tags = array();
    	add_shortcode( 'table-cell', 'tablepress_table_cell_shortcode' );
    	$content = do_shortcode( $content );
    	$shortcode_tags = $orig_shortcode_tags;
    	return $content;
    }

    Regards,
    Tobias

    Thread Starter rdellconsulting

    (@rdellconsulting)

    Perfect thanks.

    I provide support for the Customizr theme where I promote child themes. Just looked it up to see if there is a child plugin concept and there doesn’t seem to be.

    So I need to add this code if you ever update the plugin, or how would you recommend I do that (other than manually)?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, you would have to readd the code, but as those Extensions don’t get auto-updated (they are not in the WordPress Plugin Repository), the update process is manual anyway.

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Single Cell Content Shortcode in Text Widget’ is closed to new replies.