0

How can i add a custom class to the my custom widget.

 public function __construct() {

        $widget_options = array(
           'classname' => '**custom_class**',
          'description' => 'List Groups',
        );
        parent::__construct( 'custom_id', 'Groups Menu', $widget_options );
    }
  • You're doing it... What's the problem? – Jacob Peattie Jan 11 '18 at 7:51
  • I need my widget to have a custom class. – Pavitra Mehta Jan 11 '18 at 7:51
  • My code doesn't add any custom class to the custom admin widget. Am I missing anything? Does this makes any sense @JacobPeattie ? – Pavitra Mehta Jan 11 '18 at 8:49
  • What is the code you're using to display the widget. – Jacob Peattie Jan 11 '18 at 8:58
  • 3
    Whatever you set to classname on the widget should be appearing. Only reason it wouldn't is if your theme isn't including the class in the before_widget argument of register_sidebar(). See this example from the developer resources. – Jacob Peattie Jan 11 '18 at 14:01

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.