Wednesday, July 18, 2018

How do i register 4th footer sidebar in the hestia theme on its core?

Step1: Find Array of sidebars registered in the footer area Class

Step2: You can on themes->hestia->inc->core->class-hestia-public.php

You see there is a public function, you can change here 3 to 4 0r 5 whatever you want, you can add in filters at first

public function initialize_widgets() {


$footer_sidebars_array = apply_filters(
            'hestia_footer_widget_areas_array', array(
                'footer-one-widgets'   => esc_html__( 'Footer One', 'hestia' ),
                'footer-two-widgets'   => esc_html__( 'Footer Two', 'hestia' ),
                'footer-three-widgets' => esc_html__( 'Footer Three', 'hestia' ),
                'footer-four-widgets' => esc_html__( 'Footer Four', 'hestia' ),
            )
        );


}

Step3: I have added 4th footer widget above to the theme core's filter, now you have add 4th on theme mod that need to be registered

            $hestia_nr_footer_widgets = get_theme_mod( 'hestia_nr_footer_widgets', '4' );



step5: Once registered, you have to change on Render the footer sidebars.

You can find themes->hestia->inc->views->main->class-hestia-footer.php

Step6: you have to find these lines and to change 3 into 4

private function render_footer_sidebars() {

if ( ! $this->does_footer_have_widgets() ) {
            return;
        }

        $this->number_of_sidebars    = get_theme_mod( 'hestia_nr_footer_widgets', '4' );
        $this->footer_sidebars_array = array_slice( $this->footer_sidebars_array, 0, $this->number_of_sidebars );


}


Step7: You can refresh admin and see , there is a new widget showing like " Footer Four". Now you can add available widgets into 4th fouth footer widget.

Need web site

No comments: