本文整理汇总了PHP中twentyfifteen_get_color_scheme函数的典型用法代码示例。如果您正苦于以下问题:PHP twentyfifteen_get_color_scheme函数的具体用法?PHP twentyfifteen_get_color_scheme怎么用?PHP twentyfifteen_get_color_scheme使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了twentyfifteen_get_color_scheme函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: twentyfifteen_setup
/**
* 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 Twenty Fifteen 1.0
*/
function twentyfifteen_setup()
{
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on twentyfifteen, use a find and replace
* to change 'twentyfifteen' to the name of your theme in all the template files
*/
load_theme_textdomain('twentyfifteen', 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', 'twentyfifteen'), 'top_header' => __('Top Header Menu', 'twentyfifteen'), 'social' => __('Social Links Menu', 'twentyfifteen')));
/*
* 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 = twentyfifteen_get_color_scheme();
$default_color = trim($color_scheme[0], '#');
// Setup the WordPress core custom background feature.
add_theme_support('custom-background', apply_filters('twentyfifteen_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', twentyfifteen_fonts_url()));
/* image size */
add_image_size('menu-image', 127, 140, 1);
add_image_size('fire-image', 208, 232, 1);
/* Set default local timezone */
date_default_timezone_set(get_field('default_timezone', 'option'));
}
示例2: twentyfifteen_customize_register
/**
* Add postMessage support for site title and description for the Customizer.
*
* @since Twenty Fifteen 1.0
*
* @param WP_Customize_Manager $wp_customize Customizer object.
*/
function twentyfifteen_customize_register($wp_customize)
{
$color_scheme = twentyfifteen_get_color_scheme();
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
// Add color scheme setting and control.
$wp_customize->add_setting('color_scheme', array('default' => 'default', 'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme', 'transport' => 'postMessage'));
$wp_customize->add_setting('color_scheme_css', array('default' => '', 'sanitize_callback' => 'esc_html', 'transport' => 'postMessage'));
$wp_customize->add_control('color_scheme', array('label' => esc_html__('Base Color Scheme', 'twentyfifteen'), 'section' => 'colors', 'type' => 'select', 'choices' => twentyfifteen_get_color_scheme_choices(), 'priority' => 1));
// Add custom header and sidebar text color setting and control.
$wp_customize->add_setting('sidebar_textcolor', array('default' => $color_scheme[4], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'sidebar_textcolor', array('label' => esc_html__('Header and Sidebar Text Color', 'twentyfifteen'), 'description' => esc_html__('Only applied to the sidebar on wider screens. On small screens the sidebar will become the header.', 'twentyfifteen'), 'section' => 'colors')));
// Remove the core header textcolor control, as it shares the sidebar text color.
$wp_customize->remove_control('header_textcolor');
// Add custom header and sidebar background color setting and control.
$wp_customize->add_setting('header_background_color', array('default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_background_color', array('label' => esc_html__('Header and Sidebar Background Color', 'twentyfifteen'), 'description' => esc_html__('Only applied to the sidebar on wider screens. On small screens the sidebar will become the header.', 'twentyfifteen'), 'section' => 'colors')));
// Add an additional description to the header image section.
$wp_customize->get_section('header_image')->description = esc_html__('Only applied to the sidebar on wide screens. On small screens it will be applied to the header.', 'twentyfifteen');
}
示例3: webcomic2015_custom_header_setup
/** CUSTOM HEADER SETUP
* Set up the WordPress core custom header feature.
*
* @uses twentyfifteen_header_style()
*/
function webcomic2015_custom_header_setup()
{
remove_action('after_setup_theme', 'twentyfifteen_custom_header_setup');
$color_scheme = twentyfifteen_get_color_scheme();
$default_text_color = trim($color_scheme[4], '#');
/**
* Filter Twenty Fifteen custom-header support arguments.
*
* @since Twenty Fifteen 1.0
*
* @param array $args {
* An array of custom-header support arguments.
*
* @type string $default_text_color Default color of the header text.
* @type int $width Width in pixels of the custom header image. Default 954.
* @type int $height Height in pixels of the custom header image. Default 1300.
* @type string $wp-head-callback Callback function used to styles the header image and text
* displayed on the blog.
* }
*/
add_theme_support('custom-header', apply_filters('twentyfifteen_custom_header_args', array('default-text-color' => $default_text_color, 'width' => 1300, 'height' => 1300, 'wp-head-callback' => 'twentyfifteen_header_style')));
}
示例4: twentyfifteen_sidebar_text_color_css
/**
* Enqueues front-end CSS for the sidebar text color.
*
* @since Twenty Fifteen 1.0
*/
function twentyfifteen_sidebar_text_color_css()
{
$color_scheme = twentyfifteen_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 = twentyfifteen_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,
//.........这里部分代码省略.........
示例5: twentyfifteen_color_scheme_css
/**
* Enqueues front-end CSS for color scheme.
*
* @since Twenty Fifteen 1.0
*
* @see wp_add_inline_style()
*/
function twentyfifteen_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 = twentyfifteen_get_color_scheme();
// Convert main and sidebar text hex color to rgba.
$color_textcolor_rgb = twentyfifteen_hex2rgb($color_scheme[3]);
$color_sidebar_textcolor_rgb = twentyfifteen_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 = twentyfifteen_get_color_scheme_css($colors);
wp_add_inline_style('twentyfifteen-style', $color_scheme_css);
}
示例6: twentyfifteen_color_scheme_css
/**
* Enqueues front-end CSS for color scheme.
*
* @since Twenty Fifteen 1.0
*/
function twentyfifteen_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;
}
// If we get this far, we have custom styles. Let's do this.
$color_scheme = twentyfifteen_get_color_scheme();
// Convert main and sidebar text hex color to rgba.
$color_main_text_rgb = twentyfifteen_hex2rgb($color_scheme[3]);
$color_sidebar_link_rgb = twentyfifteen_hex2rgb($color_scheme[4]);
$color_background = $color_scheme[0];
$color_sidebar_background = $color_scheme[1];
$color_box_background = $color_scheme[2];
$color_main_text = $color_scheme[3];
$color_secondary_text = vsprintf('rgba( %1$s, %2$s, %3$s, 0.7)', $color_main_text_rgb);
$color_border = vsprintf('rgba( %1$s, %2$s, %3$s, 0.1)', $color_main_text_rgb);
$color_border_focus = vsprintf('rgba( %1$s, %2$s, %3$s, 0.3)', $color_main_text_rgb);
$color_sidebar_link = $color_scheme[4];
$color_sidebar_text = vsprintf('rgba( %1$s, %2$s, %3$s, 0.7)', $color_sidebar_link_rgb);
$color_sidebar_border = vsprintf('rgba( %1$s, %2$s, %3$s, 0.1)', $color_sidebar_link_rgb);
$color_sidebar_border_focus = vsprintf('rgba( %1$s, %2$s, %3$s, 0.3)', $color_sidebar_link_rgb);
$color_meta_box = $color_scheme[5];
$css = '
/* Color Scheme */
/* Background Color */
body {
background-color: %1$s;
}
/* Sidebar Background Color */
body:before,
.site-header {
background-color: %2$s;
}
/* Box Background Color */
.post-navigation,
.pagination,
.secondary,
.site-footer,
.hentry,
.page-header,
.page-content,
.comments-area {
background-color: %3$s;
}
/* Box Background Color */
button,
input[type="button"],
input[type="reset"],
input[type="submit"],
.pagination .prev,
.pagination .next,
.pagination .prev:before,
.pagination .next:before,
.entry-content .page-links a,
.entry-content .page-links a:hover,
.entry-content .page-links a:focus,
.sticky-post {
color: %3$s;
}
/* Main Text Color */
button,
input[type="button"],
input[type="reset"],
input[type="submit"],
.pagination .prev,
.pagination .next,
.page-links a,
.sticky-post {
background-color: %4$s;
}
/* Main Text Color */
body,
blockquote cite,
blockquote small,
a,
.image-navigation a:hover,
.image-navigation a:focus,
.comment-navigation a:hover,
.comment-navigation a:focus,
.entry-footer a:hover,
.entry-footer a:focus,
.comment-metadata a:hover,
.comment-metadata a:focus,
.pingback .edit-link a:hover,
.pingback .edit-link a:focus,
.comment-list .reply a:hover,
.comment-list .reply a:focus,
//.........这里部分代码省略.........
示例7: twentyfifteen_admin_header_image
/**
* Custom header image markup displayed on the Appearance > Header admin panel.
*
* @since Twenty Fifteen 1.0
* @see twentyfifteen_custom_header_setup().
*/
function twentyfifteen_admin_header_image()
{
$style = sprintf(' style="color:#%s;"', get_header_textcolor());
$color_scheme = twentyfifteen_get_color_scheme();
$header_background_color = get_theme_mod('header_background_color', $color_scheme[1]);
?>
<div id="headimg" style="background-image: url(<?php
header_image();
?>
); background-color: <?php
echo esc_attr($header_background_color);
?>
;">
<h1 class="displaying-header-text"><a id="name"<?php
echo $style;
?>
onclick="return false;" href="<?php
echo esc_url(home_url('/'));
?>
"><?php
bloginfo('name');
?>
</a></h1>
<div id="desc" class="displaying-header-text"<?php
echo $style;
?>
><?php
bloginfo('description');
?>
</div>
</div>
<?php
}
示例8: twentyfifteen_setup
/**
* 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 Twenty Fifteen 1.0
*/
function twentyfifteen_setup()
{
/*
* Make theme available for translation.
* Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentyfifteen
* If you're building a theme based on twentyfifteen, use a find and replace
* to change 'twentyfifteen' to the name of your theme in all the template files
*/
load_theme_textdomain('twentyfifteen');
// 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', 'twentyfifteen'), 'social' => __('Social Links Menu', 'twentyfifteen')));
/*
* 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'));
/*
* Enable support for custom logo.
*
* @since Twenty Fifteen 1.5
*/
add_theme_support('custom-logo', array('height' => 248, 'width' => 248, 'flex-height' => true));
$color_scheme = twentyfifteen_get_color_scheme();
$default_color = trim($color_scheme[0], '#');
// Setup the WordPress core custom background feature.
add_theme_support('custom-background', apply_filters('twentyfifteen_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', twentyfifteen_fonts_url()));
// Indicate widget sidebars can use selective refresh in the Customizer.
add_theme_support('customize-selective-refresh-widgets');
}
示例9: twentyfifteen_setup
/**
* 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 Twenty Fifteen 1.0
*/
function twentyfifteen_setup()
{
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on twentyfifteen, use a find and replace
* to change 'twentyfifteen' to the name of your theme in all the template files
*/
load_theme_textdomain('twentyfifteen', 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', 'twentyfifteen'), 'footer' => __('Footer Menu', 'twentyfifteen'), 'top-header' => __('Top Header Menu', 'twentyfifteen'), 'our-products' => __('Our Products Menu', 'twentyfifteen'), 'career-nav' => __('Career details page navigation menu', 'twentyfifteen'), 'about-nav' => __('About us page navigation menu', 'twentyfifteen'), 'engineering-nav' => __('Engineering details page navigation menu', 'twentyfifteen'), 'responsibility-nav' => __('Resposibility details page navigation menu', 'twentyfifteen'), 'our-business-nav' => __('Our Business page navigation menu', 'twentyfifteen'), 'media-nav' => __('Media navigation menu', 'twentyfifteen'), 'social' => __('Social Links Menu', 'twentyfifteen')));
/*
* 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 = twentyfifteen_get_color_scheme();
$default_color = trim($color_scheme[0], '#');
// Setup the WordPress core custom background feature.
add_theme_support('custom-background', apply_filters('twentyfifteen_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', twentyfifteen_fonts_url()));
add_image_size('banner_image', 2000, 568);
add_image_size('home_portfolio_banner_image', 1109, 346);
add_image_size('home_main_image', 570, 196);
add_image_size('home_what_we_do_image', 585, 400);
add_image_size('home_career_image', 376, 238);
add_image_size('home_latest_news_image', 121, 110);
add_image_size('who_we_are_page_image', 266, 292);
add_image_size('who_we_are_certification_image', 264, 171);
add_image_size('portfolio_image', 555, 332);
add_image_size('portfolio_gallery_image', 1118, 582);
add_image_size('career_page_image', 266, 200);
add_image_size('career_search_image', 560, 367);
add_image_size('leadership_list_image', 220, 124);
add_image_size('omega_frontline_image', 460, 259);
}