我试图创建一个简单的窗口小部件以显示特定类别的帖子列表,但出现错误日志,"Notice: Undefined index: after_widget in"
我还注意到一个奇怪的事情,我的窗口小部件<aside>类使所有其他窗口小部件成为其子级,她没有关闭完成小部件代码后,
这是我的代码:
if ( !defined('ABSPATH') )
die('-1');
add_action( 'widgets_init', function(){
register_widget( 'news_roller' );
});
function illu_news_widget(){
wp_enqueue_style( 'your-stylesheet-name', plugins_url('/css/style.css', __FILE__), false, '1.0.0', 'all');
}
add_action('wp_enqueue_scripts', "illu_news_widget");
/**
* Adds news_roller widget.
*/
class news_roller extends WP_Widget {
/**
* Register widget with WordPress.
*/
function __construct() {
parent::__construct(
'news_roller', // Base ID
__('News roller', 'isas_news'), // Name
array( 'description' => __( 'News roller', 'isas_news' ), ) // Args
);
}
/**
* …Run Code Online (Sandbox Code Playgroud)