I am using shortcode to call a widget. All is working fine but I want to pass some $instance(parameters) to the_widget
. I am using $content
to pass paramets to the_widget
but I dont see any chnages after setting parameters.
Here is my shortcode function
add_shortcode('widget','widget');
function widget($atts) {
// Configure defaults and extract the attributes into variables
extract( shortcode_atts(
array(
'name' => ''
),
$atts
));
$args = array(
'before_widget' => '<div class="box widget">',
'after_widget' => '</div>',
'before_title' => '<div class="widget-title">',
'after_title' => '</div>',
);
ob_start();
the_widget( $name, $content, $args );
$output = ob_get_clean();
return $output;
}
And this is shortcode
[widget name="WP_Widget_Pages"]title=Pages&sortby=post_title[widget]
Please tell me what is the problem