Skip to content

Commit

Permalink
Merge pull request elementor#12689 from matipojo/hotfix/global-style-…
Browse files Browse the repository at this point in the history
…missing-on-embed-elementor-template

Kit: Fix - Kit style is missing on embed a saved template. (Fix PT#1054)
  • Loading branch information
KingYes authored Sep 30, 2020
2 parents 18b6f3a + b0f6dba commit e4ebc33
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions core/kits/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ public function frontend_before_enqueue_styles() {
}

$css_file->enqueue();

Plugin::$instance->frontend->add_body_class( 'elementor-kit-' . $kit->get_main_id() );
}
}

Expand Down Expand Up @@ -250,6 +248,20 @@ public function is_custom_typography_enabled() {
return ! get_option( 'elementor_disable_typography_schemes' );
}

/**
* Add kit wrapper body class.
*
* It should be added even for non Elementor pages,
* in order to support embedded templates.
*/
private function add_body_class() {
$kit = $this->get_kit_for_frontend();

if ( $kit ) {
Plugin::$instance->frontend->add_body_class( 'elementor-kit-' . $kit->get_main_id() );
}
}

public function __construct() {
add_action( 'elementor/documents/register', [ $this, 'register_document' ] );
add_filter( 'elementor/editor/localize_settings', [ $this, 'localize_settings' ] );
Expand All @@ -265,5 +277,9 @@ public function __construct() {
add_action( 'update_option_blogdescription', function ( $old_value, $value ) {
$this->update_kit_settings_based_on_option( 'site_description', $value );
}, 10, 2 );

add_action( 'wp_head', function() {
$this->add_body_class();
} );
}
}

0 comments on commit e4ebc33

Please sign in to comment.