/** * Enqueues front-end CSS for color scheme. * * @since Conversations Made Possible 1.0 * * @see wp_add_inline_style() */ function conversationsmp_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 = conversationsmp_get_color_scheme(); // Convert main and sidebar text hex color to rgba. $color_textcolor_rgb = conversationsmp_hex2rgb($color_scheme[3]); $color_sidebar_textcolor_rgb = conversationsmp_hex2rgb($color_scheme[4]); $colors = array('background_color' => $color_scheme[0], 'header_background_color' => $color_scheme[1], 'box_background_color' => $color_scheme[2], 'textcolor' => $color_scheme[3], 'secondary_textcolor' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.7)', $color_textcolor_rgb), 'border_color' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.1)', $color_textcolor_rgb), 'border_focus_color' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.3)', $color_textcolor_rgb), 'sidebar_textcolor' => $color_scheme[4], 'sidebar_border_color' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.1)', $color_sidebar_textcolor_rgb), 'sidebar_border_focus_color' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.3)', $color_sidebar_textcolor_rgb), 'secondary_sidebar_textcolor' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.7)', $color_sidebar_textcolor_rgb), 'meta_box_background_color' => $color_scheme[5]); $color_scheme_css = conversationsmp_get_color_scheme_css($colors); wp_add_inline_style('conversationsmp-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 Conversations Made Possible 1.0 */ function conversationsmp_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on conversationsmp, use a find and replace * to change 'conversationsmp' to the name of your theme in all the template files */ load_theme_textdomain('conversationsmp', get_template_directory() . '/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' => __('Primary Menu', 'conversationsmp'), 'social' => __('Social Links Menu', 'conversationsmp'))); /* * 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 = conversationsmp_get_color_scheme(); $default_color = trim($color_scheme[0], '#'); // Setup the WordPress core custom background feature. add_theme_support('custom-background', apply_filters('conversationsmp_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(array('css/editor-style.css', 'genericons/genericons.css', conversationsmp_fonts_url())); }