Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
wordpress-使用短代码调用小部件_Wordpress_Shortcode - Fatal编程技术网

wordpress-使用短代码调用小部件

wordpress-使用短代码调用小部件,wordpress,shortcode,Wordpress,Shortcode,我正在使用短代码调用一个小部件。一切正常,但我想将一些$instance(参数)传递给\u小部件。我正在使用$content将参数传递给小部件,但设置参数后,我看不到任何变化 这是我的快捷码函数 add_shortcode('widget','widget'); function widget($atts) { // Configure defaults and extract the attributes into variables extract( shortcode_at

我正在使用短代码调用一个小部件。一切正常,但我想将一些$instance(参数)传递给\u小部件
。我正在使用
$content
将参数传递给
小部件
,但设置参数后,我看不到任何变化

这是我的快捷码函数

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;    
}
请告诉我有什么问题

[widget name="WP_Widget_Pages"]title=Pages&sortby=post_title[widget]