• Resolved Karis

    (@askel45)


    Hi. I tried looking for the widget class to hide this plugin’s widget from Appearance>Widgets but I could not find it (it had dashes instead of underscores). I always declutter my widgets area and so far, only this plugin’s widget class I haven’t figured out yet. Or even better, provide an option to hide the widget altogether in settings?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Lap

    (@lapzor)

    Hi Martin,

    You can right click it, and choose “inspect” and you should see the ID of the widget, something like “widget-50_koko-analytics-most-viewed-posts-__i__”

    Since it’s an ID you add # in front of it in CSS, so

    #widget-50_koko-analytics-most-viewed-posts-__i__ { display: none; }

    Hope that helps. If you have any questions, please let me know!

    Thread Starter Karis

    (@askel45)

    I am using PHP to hide the widgets, not CSS. This part koko-analytics-most-viewed-posts didn’t work. My code is like below. As you can see, the widget classes have underscores in default widgets and those added by other plugins. I would like to do the same for this plugin,

    function unregister_default_widgets() {
    	unregister_widget('WP_Widget_Categories');
    }
    add_action('widgets_init', 'unregister_default_widgets');
    • This reply was modified 4 years, 5 months ago by Karis.
    Plugin Support Lap

    (@lapzor)

    I think it should be this:

    function unregister_default_widgets() {
    unregister_widget(‘KokoAnalytics\Widget_Most_Viewed_Posts’);
    }
    add_action(‘widgets_init’, ‘unregister_default_widgets’);

    For non default WordPress widgets you need to include the Namespace.

    Let me know if that doesn’t work.

    Thread Starter Karis

    (@askel45)

    It worked! Big thanks.

    Plugin Support Lap

    (@lapzor)

    Perfect, Thanks for letting me know.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘What’s the widget class?’ is closed to new replies.