function hocwp_setup_theme_custom_head() { $options = get_option('hocwp_theme_custom'); $background_image = hocwp_get_value_by_key($options, 'background_image'); $background_image = hocwp_get_media_option_url($background_image); if (hocwp_url_valid($background_image)) { $style = new HOCWP_HTML('style'); $style->set_attribute('type', 'text/css'); $elements = array('body.hocwp'); $properties = array('background-image' => 'url("' . $background_image . '")', 'background-repeat' => 'no-repeat', 'background-color' => 'rgba(0,0,0,0)'); $lazyload = hocwp_get_value_by_key($options, 'background_lazyload'); if ((bool) $lazyload) { unset($properties['background-image']); } $background_repeat = hocwp_get_value_by_key($options, 'background_repeat'); if ((bool) $background_repeat) { $properties['background-repeat'] = 'repeat'; } $background_color = hocwp_get_value_by_key($options, 'background_color'); if (hocwp_color_valid($background_color)) { $properties['background-color'] = $background_color; } $background_size = hocwp_get_value_by_key($options, 'background_size'); if (!empty($background_size)) { $properties['background-size'] = $background_size; } $background_position = hocwp_get_value_by_key($options, 'background_position'); if (!empty($background_position)) { $properties['background-position'] = $background_position; } $background_attachment = hocwp_get_value_by_key($options, 'background_attachment'); if (!empty($background_attachment)) { $properties['background-attachment'] = $background_attachment; } $css = hocwp_build_css_rule($elements, $properties); $css = hocwp_minify_css($css); $style->set_text($css); if (!empty($css)) { $style->output(); } } }
function hocwp_is_color($color) { return hocwp_color_valid($color); }