Last active
September 4, 2016 12:39
-
-
Save pravdomil/88e41bab9402e6fb4a4802add43c1b97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SiteOrigin_Widget_InlineCSS extends SiteOrigin_Widget { | |
function generate_and_enqueue_instance_styles($instance) { | |
if(empty($this->form_options)) $this->form_options = $this->initialize_form(); | |
if(empty($instance)) return; | |
$instance = $this->add_defaults($this->form_options, $instance); | |
$css_name = $this->id_base . '-' . $this->get_style_name($instance) . '-' . $this->get_style_hash($instance); | |
$css = wp_cache_get($css_name, 'siteorigin_widgets'); | |
if(empty($css)) { | |
$css = $this->get_instance_css($instance); | |
wp_cache_add($css_name, $css, 'siteorigin_widgets'); | |
} | |
siteorigin_widget_add_inline_css($css); | |
return $css_name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment