ショートコードを使用してウィジェットを呼び出しています。すべて正常に動作していますが、いくつかの $instance(parameters) を に渡したいですthe_widget
。$content
パラメータを渡すために使用してthe_widget
いますが、パラメータを設定した後に変化が見られません。
ここに私のショートコード関数があります
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]
何が問題なのか教えてください