Đây là code mẫu:
function my_flatsome_widgets_init() {
remove_action( ‘widgets_init’, ‘flatsome_widgets_init’ );
$title_before = ”;
$title_class = ”;
$title_after = ‘
‘;
register_sidebar( array(
‘name’ => __( ‘Footer 2’, ‘flatsome’ ),
‘id’ => ‘sidebar-footer-2’,
‘before_widget’ => ‘
‘,
‘before_title’ => ‘
‘,
) );
}
add_action( ‘widgets_init’, ‘my_flatsome_widgets_init’, 0);
Đầu tiên, cần remove action cũ của main theme. Sau đó thêm action cho child theme, lưu ý thứ tự số ở cuối cùng (ở đây là số 0 )
Link tham khảo:
https://wordpress.stackexchange.com/questions/203618/widgets-init-actions-not-fired-from-functions-phps-child-theme
