'string', 'description' => __( 'Load version 1 styles for backward compatibility', STACKABLE_I18N ), 'sanitize_callback' => 'sanitize_text_field', 'show_in_rest' => true, 'default' => '', ) ); } add_action( 'init', 'stackable_register_load_v1_styles_option' ); } if ( ! function_exists( 'stackable_should_load_v1_styles' ) ) { /** * Should we load v1 styles * * @return Boolean * * @since 2.0 */ function stackable_should_load_v1_styles() { return get_option( 'stackable_load_v1_styles' ) === '1'; } } /******************************************************************************************** * END Version 1 frontend styles backward compatibility. ********************************************************************************************/ /******************************************************************************************** * Version 1 & TwentyTwenty frontend styles backward compatibility. ********************************************************************************************/ if ( ! function_exists( 'stackable_twentytwenty_body_class' ) ) { /** * Adds a twentytwenty class name to the body if the twentytwenty is used. */ function stackable_twentytwenty_body_class( $classes ) { $classes[] = 'ugb--twentytwentytwenty-compat'; return $classes; } function stackable_twentytwenty_compat() { if ( function_exists( 'twentytwenty_theme_support' ) && stackable_should_load_v1_styles() ) { add_filter( 'body_class','stackable_twentytwenty_body_class' ); } } add_action( 'wp', 'stackable_twentytwenty_compat' ); } /******************************************************************************************** * END Version 1 & TwentyTwenty frontend styles backward compatibility. ********************************************************************************************/