/** * Enqueues front-end CSS for color scheme. * * @since Kute Theme 1.0 * * @see wp_add_inline_style() */ function kt_color_scheme_css() { $color_scheme_option = get_theme_mod('color_scheme', 'default'); $color_scheme = kt_get_color_scheme(); $main_color = get_theme_mod('main_color', $color_scheme[1]); $box_background_color = get_theme_mod('box_background_color', $color_scheme[2]); $textcolor = get_theme_mod('textcolor', $color_scheme[3]); $price_color = get_theme_mod('price_color', $color_scheme[8]); // Convert main and sidebar text hex color to rgba. $color_button_rgb = kt_hex2rgb($color_scheme[5]); $color_main_rgb = kt_hex2rgb($main_color); $colors = array('background_color' => $color_scheme[0], 'main_color' => $main_color, 'box_background_color' => $box_background_color, 'textcolor' => $textcolor, 'rate_color' => $color_scheme[4], 'button_color' => $color_scheme[5], 'menu_link_footer' => $color_scheme[6], 'module_bored' => $color_scheme[7], 'price_color' => $price_color, 'button_color_rgb' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.4)', $color_button_rgb), 'color_main_rgb' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.5)', $color_main_rgb)); $color_scheme_css = kt_get_color_scheme_css($colors); wp_add_inline_style('kutetheme-style', $color_scheme_css); }
/** * Enqueues front-end CSS for color scheme. * * @since Kute Theme 1.0 * * @see wp_add_inline_style() */ function kt_color_scheme_css() { $color_scheme_option = get_theme_mod('color_scheme', 'default'); // Don't do anything if the default color scheme is selected. if ('default' === $color_scheme_option) { return; } $color_scheme = kt_get_color_scheme(); // Convert main and sidebar text hex color to rgba. $color_button_rgb = kt_hex2rgb($color_scheme[5]); $color_main_rgb = kt_hex2rgb($color_scheme[1]); $colors = array('background_color' => $color_scheme[0], 'main_color' => $color_scheme[1], 'box_background_color' => $color_scheme[2], 'textcolor' => $color_scheme[3], 'rate_color' => $color_scheme[4], 'button_color' => $color_scheme[5], 'menu_link_footer' => $color_scheme[6], 'button_color_rgb' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.4)', $color_button_rgb), 'color_main_rgb' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.5)', $color_main_rgb)); $color_scheme_css = kt_get_color_scheme_css($colors); wp_add_inline_style('kutetheme-style', $color_scheme_css); }
/** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. * * @since Kute theme 1.0.0 */ function kt_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on kutetheme, use a find and replace * to change 'kutetheme' to the name of your theme in all the template files */ load_theme_textdomain('kutetheme', THEME_DIR . '/languages'); // Add default posts and comments RSS feed links to head. add_theme_support('automatic-feed-links'); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded <title> tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support('title-tag'); /* * Enable support for Post Thumbnails on posts and pages. * * See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_theme_support('post-thumbnails'); set_post_thumbnail_size(825, 510, true); // This theme uses wp_nav_menu() in two locations. register_nav_menus(array('primary' => esc_attr__('Primary Menu', 'kutetheme'), 'vertical' => esc_attr__('Vertical Menu', 'kutetheme'), 'custom_header_menu' => esc_attr__('Custom Header Menu', 'kutetheme'), 'custom_footer_menu' => esc_attr__('Custom Footer Menu', 'kutetheme'))); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption')); /* * Enable support for Post Formats. * * See: https://codex.wordpress.org/Post_Formats */ /* add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat' ) ); */ $color_scheme = kt_get_color_scheme(); $default_color = trim($color_scheme[0], '#'); // Setup the WordPress core custom background feature. add_theme_support('custom-background', apply_filters('kt_custom_background_args', array('default-color' => $default_color, 'default-attachment' => 'fixed'))); /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, icons, and column width. */ add_editor_style(THEME_URL . 'css/editor-style.css'); add_image_size('kt-post-thumb', 345, 244, true); add_image_size('kt-post-thumb-small', 70, 49, true); add_image_size('kt_post_blog_268x255', 268, 255, true); }
/** * Enqueues front-end CSS for the sidebar text color. * * @since Kute Theme 1.0 */ function kt_sidebar_text_color_css() { $color_scheme = kt_get_color_scheme(); $default_color = $color_scheme[4]; $sidebar_link_color = get_theme_mod('sidebar_textcolor', $default_color); // Don't do anything if the current color is the default. if ($sidebar_link_color === $default_color) { return; } // If we get this far, we have custom styles. Let's do this. $sidebar_link_color_rgb = kt_hex2rgb($sidebar_link_color); $sidebar_text_color = vsprintf('rgba( %1$s, %2$s, %3$s, 0.7)', $sidebar_link_color_rgb); $sidebar_border_color = vsprintf('rgba( %1$s, %2$s, %3$s, 0.1)', $sidebar_link_color_rgb); $sidebar_border_focus_color = vsprintf('rgba( %1$s, %2$s, %3$s, 0.3)', $sidebar_link_color_rgb); $css = ' /* Custom Sidebar Text Color */ .site-title a, .site-description, .secondary-toggle:before { color: %1$s; } .site-title a:hover, .site-title a:focus { color: %1$s; /* Fallback for IE7 and IE8 */ color: %2$s; } .secondary-toggle { border-color: %1$s; /* Fallback for IE7 and IE8 */ border-color: %3$s; } .secondary-toggle:hover, .secondary-toggle:focus { border-color: %1$s; /* Fallback for IE7 and IE8 */ border-color: %4$s; } .site-title a { outline-color: %1$s; /* Fallback for IE7 and IE8 */ outline-color: %4$s; } @media screen and (min-width: 59.6875em) { .secondary a, .dropdown-toggle:after, .widget-title, .widget blockquote cite, .widget blockquote small { color: %1$s; } .widget button, .widget input[type="button"], .widget input[type="reset"], .widget input[type="submit"], .widget_calendar tbody a { background-color: %1$s; } .textwidget a { border-color: %1$s; } .secondary a:hover, .secondary a:focus, .main-navigation .menu-item-description, .widget, .widget blockquote, .widget .wp-caption-text, .widget .gallery-caption { color: %2$s; } .widget button:hover, .widget button:focus, .widget input[type="button"]:hover, .widget input[type="button"]:focus, .widget input[type="reset"]:hover, .widget input[type="reset"]:focus, .widget input[type="submit"]:hover, .widget input[type="submit"]:focus, .widget_calendar tbody a:hover, .widget_calendar tbody a:focus { background-color: %2$s; } .widget blockquote { border-color: %2$s; } .main-navigation ul, .main-navigation li, .secondary-toggle, .widget input, .widget textarea, .widget table, .widget th, .widget td, .widget pre, .widget li, .widget_categories .children, .widget_nav_menu .sub-menu, .widget_pages .children, .widget abbr[title] { border-color: %3$s; } .dropdown-toggle:hover, .dropdown-toggle:focus, .widget hr { background-color: %3$s; } .widget input:focus, .widget textarea:focus { border-color: %4$s; } .sidebar a:focus, .dropdown-toggle:focus { outline-color: %4$s; } } '; wp_add_inline_style('kt-style', sprintf($css, $sidebar_link_color, $sidebar_text_color, $sidebar_border_color, $sidebar_border_focus_color)); }