How the widget can be run by shortcode

I have my own widget, that uses WP_Widget class, and executes its code inside function in this class.
Is there any ways to run this widget using shortcode inside post?

This is how my widget structure looks like:

add_action( 'widgets_init', 'register_my_widget' );
function register_my_widget() {}
class My_Widget extends WP_Widget () {
    function My_Widget() {}
    function widget() {}
    function update() {}
    function form() {}
}

How can I add the shortcode for executing this widget?

1 Answer
1

I think you are out of luck as wordpress core doesn’t have this kind of functionality. Quick googling shows that there are plugins to do that like this one http://wordpress.org/extend/plugins/amr-shortcode-any-widget/, but if you have programming skills you should probably write a shortcode handler with/instead of the widget.

Leave a Comment