最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Unable to see Widget Submenu under Appearance with Class Based WP_Widget

programmeradmin3浏览0评论

I am trying to create custom widget it appear into a ACF (Advanced Custom Fields) plugin but "Widget Menu is not appearing below appearance menu. here are my codes.

my functions.php

<?php
## import the dependency functions 
require get_template_directory() . '/inc/functions-admin.php';
require get_template_directory() . '/inc/widgets.php';

my inc/widgets.php

<?php
/*
@package ManishAgarwal
    ==================
    WIDGET CLASS
    ==================
*/

class CustomWidget extends WP_Widget {

    public function __construct() {
        // Instantiate the parent object
        $widget_ops = array(
            'classname' => 'ma-home-widget',
            'description' => 'Custom Home Content Widget',
        );
        parent::__construct('ma_home_content','MA Home Content', $widget_ops );
    }
}

function ma_register_widgets() {
    register_widget( 'CustomWidget' );
}

add_action( 'widgets_init', 'ma_register_widgets' );

please suggest where i am doing wrong in above code snippet.

发布评论

评论列表(0)

  1. 暂无评论