@@ -35,17 +35,23 @@ function __construct() {
3535 // Add a filter for replacing shortcut media queries before the breakpoint adjustment.
3636 add_filter ( 'stackable_frontend_css ' , array ( $ this , 'replace_shortcut_media_queries ' ), 9 );
3737
38- if ( $ this ->has_custom_breakpoints () ) {
39- // Add our filter that adjusts all CSS that we print out.
40- add_filter ( 'stackable_frontend_css ' , array ( $ this , 'adjust_breakpoints ' ) );
38+ // This make sure all add_filter( 'stackable_responsive_breakpoints' , callback ) are called
39+ // before getting the dynamic breakpoints
40+ add_action ('after_setup_theme ' , array ( $ this , 'setup_frontend_breakpoints ' ) );
41+ }
42+ }
4143
42- // If there are adjusted breakpoints, enqueue our adjusted responsive css.
43- add_action ( 'stackable_block_enqueue_frontend_assets ' , array ( $ this , 'enqueue_adjusted_responsive_css ' ) );
44+ function setup_frontend_breakpoints () {
45+ if ( $ this ->has_custom_breakpoints () ) {
46+ // Add our filter that adjusts all CSS that we print out.
47+ add_filter ( 'stackable_frontend_css ' , array ( $ this , 'adjust_breakpoints ' ) );
4448
45- // Adjust the styles outputted by Stackable blocks.
46- // 11 Priority, do this last because changing style can affect inline css optimization.
47- add_filter ( 'render_block ' , array ( $ this , 'adjust_block_styles ' ), 11 , 2 );
48- }
49+ // If there are adjusted breakpoints, enqueue our adjusted responsive css.
50+ add_action ( 'stackable_block_enqueue_frontend_assets ' , array ( $ this , 'enqueue_adjusted_responsive_css ' ) );
51+
52+ // Adjust the styles outputted by Stackable blocks.
53+ // 11 Priority, do this last because changing style can affect inline css optimization.
54+ add_filter ( 'render_block ' , array ( $ this , 'adjust_block_styles ' ), 11 , 2 );
4955 }
5056 }
5157
0 commit comments