setup(); $this->init(); } /** * Initial setup. * * @since 1.0.0 */ function setup() { $support = get_theme_support( 'footer-widgets' ); if ( empty( $support ) ) { return; } if ( absint( $support[0] ) < 1 ) { return; } $this->max_widgets = absint( $support[0] ); $this->active_widgets = $this->get_number_of_active_widgets(); } /** * Initialize hooks. * * @since 1.0.0 */ function init() { if ( $this->max_widgets < 1 ) { return; } // Register footer widgets. add_action( 'widgets_init', array( $this, 'footer_widgets_init' ), 20 ); if ( $this->active_widgets > 0 ) { // Add footer widgets in front end. add_action( $this->theme_prefix . '_action_before_footer', array( $this, 'add_footer_widgets' ), 3 ); } // Add custom class in widgets. add_filter( $this->theme_prefix . '_filter_footer_widget_class', array( $this, 'custom_footer_widget_class' ) ); } /** * Register footer widgets. * * @since 1.0.0 */ function footer_widgets_init() { for ( $i = 1; $i <= $this->max_widgets; $i++ ) { register_sidebar( array( 'name' => sprintf( __( 'Footer Widget %d', 'nature-bliss' ), $i ), 'id' => sprintf( 'footer-%d', $i ), 'before_widget' => '', 'before_title' => '