Skip to content

Commit

Permalink
see #2009
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Nov 9, 2018
1 parent 87ee00e commit 2eb9875
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/css/class-kirki-modules-css.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public function init() {

// If we're in the customizer, load inline no matter what.
add_action( 'wp_enqueue_scripts', array( $this, 'inline_dynamic_css' ), $priority );
add_action( 'enqueue_block_editor_assets', array( $this, 'inline_dynamic_css' ), $priority );

// If we're using file method, on save write the new styles.
if ( 'file' === $method ) {
Expand Down Expand Up @@ -174,6 +175,9 @@ public function init() {

// If we got this far then add styles inline.
add_action( 'wp_enqueue_scripts', array( $this, 'inline_dynamic_css' ), $priority );

// Admin styles, adds Gutenberg compatibility.
add_action( 'admin_enqueue_scripts', array( $this, 'inline_dynamic_css' ), $priority );
}

/**
Expand Down
14 changes: 14 additions & 0 deletions modules/css/class-kirki-output.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,20 @@ protected function parse_output() {
}

$value = $this->process_value( $value, $output );

// Set the context.
if ( ! isset( $output['context'] ) || empty( $output['context'] ) ) {
$output['context'] = array( 'front' );
}

// Check if this is an admin style.
if ( is_admin() && ! is_customize_preview() ) {
if ( ! in_array( 'editor', $output['context'] ) ) {
return;
}
} elseif ( ! in_array( 'front', $output['context'] ) ) {
return;
}
$this->process_output( $output, $value );
}
}
Expand Down

0 comments on commit 2eb9875

Please sign in to comment.