function ci_make_custom_image_sizes_selectable($image_sizes) { global $content_width; $additional_image_sizes = ci_get_image_sizes(); if (empty($additional_image_sizes)) { return $image_sizes; } foreach ($additional_image_sizes as $id => $data) { if (!isset($image_sizes[$id])) { // Ignore user-configurable sizes as they might change anytime and screw everything up. // If you want to exclude more sizes, hook to 'image_size_names_choose' later than this function // and unset their ids. if (in_array($id, array('ci_featured_single', 'ci_featured_full'))) { continue; } // Ignore sizes that we don't care about. if (!in_array($id, array('post-thumbnail')) && !in_array(substr_left($id, 3), array('ci_', 'ci-'))) { continue; } // Let's create a readable name. $text = $id; $text = str_replace(array('ci_', 'ci-', 'featgal', CI_THEME_NAME), '', $text); $text = str_replace(array('_', '-'), ' ', $text); $text = ucwords($text); if ($data['width'] > $content_width) { $text .= ' (' . $data['width'] . ' × ' . $data['height'] . ')'; } $image_sizes[$id] = $text; } } return $image_sizes; }
function ci_theme_body_classes($classes) { // Add a ci-no-slider class to body if there are no slide items. $slides = ci_theme_get_slides(false, false, true); if ($slides->post_count == 0 && is_page_template('template-frontpage.php')) { $classes[] = 'ci-no-slider'; } // Add specific classes depending on color scheme $scheme = $classes['theme_color_scheme']; if (substr_left($scheme, 10) == 'ci-scheme-') { $scheme = str_replace('ci-scheme-', '', $scheme); if (substr_left($scheme, 6) == 'white_') { $classes['theme_color_scheme_group'] = 'ci-light-scheme'; } else { $classes['theme_color_scheme_group'] = 'ci-dark-scheme'; } } return $classes; }
function ci_background_color_value_check_hash($value) { if ((strlen($value) == 3 or strlen($value) == 6) and substr_left($value, 1) != '#') { return '#' . $value; } else { return $value; } }