在 elementor wordpress 中定义自定义类别的问题

问题描述

我正在尝试为我的小部件定义自定义类别。我在widget类中添加了以下代码

class widget_one extends \Elementor\Widget_Base{
    public function __construct(){
        add_action( 'elementor/elements/categories_registered','add_elementor_widget_categories' );
    }

    function add_elementor_widget_categories( $elements_manager ) {

        $elements_manager->add_category(
            'first-category',[
                'title' => __( 'First Category','test-add-ons' ),'icon' => 'fa fa-plug',]
        );  
    }
    
    public function get_name() {
        return 'oembed';
    }
    public function get_title() {
        return __( 'oEmbed','plugin-name' );
    }

    public function get_icon() {
        return 'fa fa-code';
    }

    public function get_categories() {
        return [ 'general' ];
    }
}

它没有给出任何错误,但没有显示类别。

Code result

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)