如何获取一组小部件?
你可以调查
$sidebars_widgets = wp_get_sidebars_widgets();
print_r( $sidebars_widgets );
下面是一个输出示例:
Array
(
[orphaned_widgets_1] => Array
(
[0] => text-6
)
[wp_inactive_widgets] => Array
(
[0] => text-7
[1] => rss-2
)
[sidebar-1] => Array
(
[0] => recent-posts-3
[1] => recent-posts-4
[2] => text-9
[3] => calendar-2
[4] => categories-3
[5] => search-4
[6] => text-8
[7] => categories-2
)
[sidebar-2] => Array
(
[0] => search-5
)
[sidebar-3] => Array
(
[0] => recent-posts-2
)
)