本文整理汇总了PHP中customizer_library_get_default函数的典型用法代码示例。如果您正苦于以下问题:PHP customizer_library_get_default函数的具体用法?PHP customizer_library_get_default怎么用?PHP customizer_library_get_default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了customizer_library_get_default函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smtm_fonts
/**
* Enqueue Google Fonts Example
*/
function smtm_fonts()
{
// Font options
$fonts = array(get_theme_mod('primary-font', customizer_library_get_default('primary-font')), get_theme_mod('secondary-font', customizer_library_get_default('secondary-font')), get_theme_mod('tertiary-font', customizer_library_get_default('tertiary-font')));
$font_uri = customizer_library_get_google_font_uri($fonts);
// Load Google Fonts
wp_enqueue_style('smtm_fonts', $font_uri, array(), null, 'screen');
}
示例2: politics_infinite_scroll_render
/**
* Custom render function for Infinite Scroll.
*/
function politics_infinite_scroll_render()
{
$politics_blog_style = get_theme_mod('politics_blog_style', customizer_library_get_default('politics_blog_style'));
while (have_posts()) {
the_post();
get_template_part('template-parts/content', $politics_blog_style);
}
}
示例3: customizer_topshop_theme_fonts
/**
* Enqueue Google Fonts Example
*/
function customizer_topshop_theme_fonts()
{
// Font options
$fonts = array(get_theme_mod('topshop-body-font', customizer_library_get_default('topshop-body-font')), get_theme_mod('topshop-heading-font', customizer_library_get_default('topshop-heading-font')));
$font_uri = customizer_library_get_google_font_uri($fonts);
// Load Google Fonts
wp_enqueue_style('customizer_topshop_theme_fonts', $font_uri, array(), null, 'screen');
}
示例4: customizer_library_gateway_styles
/**
* Generates the style tag and CSS needed for the theme options.
*
* By using the "Customizer_Library_Styles" filter, different components can print CSS in the header.
* It is organized this way to ensure there is only one "style" tag.
*
* @since 1.0.0.
*
* @return void
*/
function customizer_library_gateway_styles()
{
do_action('customizer_library_styles');
// Echo the rules
$css = Customizer_Library_Styles()->build();
$home_hero_bg = get_theme_mod('home_hero_bg', customizer_library_get_default('home_hero_bg'));
$home_hero_bg_color = get_theme_mod('home_hero_bg_color', customizer_library_get_default('home_hero_bg_color'));
$header_bg = get_theme_mod('header_bg', customizer_library_get_default('header_bg'));
$header_color = get_theme_mod('header_color', customizer_library_get_default('header_color'));
$bg_attachement = get_theme_mod('bg_attachement', customizer_library_get_default('bg_attachement'));
echo "\n<!-- Begin Custom CSS -->\n<style type=\"text/css\" id=\"rescue_custom_css\">\n";
?>
.home-header-bg {
background:url( '<?php
echo esc_url($home_hero_bg);
?>
' ) <?php
echo esc_attr($home_hero_bg_color);
?>
no-repeat center center <?php
echo esc_attr($bg_attachement);
?>
;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.header-bg {
background:url( '<?php
echo esc_url($header_bg);
?>
' ) <?php
echo esc_attr($header_color);
?>
no-repeat center center <?php
echo esc_attr($bg_attachement);
?>
;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
<?php
echo "\n</style>\n<!-- End Custom CSS -->\n";
if (!empty($css)) {
echo "\n<!-- Begin Custom CSS -->\n<style type=\"text/css\" id=\"gateway-custom-css\">\n";
echo $css;
echo "\n</style>\n<!-- End Custom CSS -->\n";
}
}
示例5: customizer_library_sanitize_choices
/**
* Sanitize a value from a list of allowed values.
*
* @since 1.0.0.
*
* @param mixed $value The value to sanitize.
* @param mixed $setting The setting for which the sanitizing is occurring.
* @return mixed The sanitized value.
*/
function customizer_library_sanitize_choices($value, $setting)
{
if (is_object($setting)) {
$setting = $setting->id;
}
$choices = customizer_library_get_choices($setting);
$allowed_choices = array_keys($choices);
if (!in_array($value, $allowed_choices)) {
$value = customizer_library_get_default($setting);
}
return $value;
}
示例6: gather_get_columns
/**
* Outputs the number of masonry columns as a data attribute
*
* @since Gather 0.1
*/
function gather_get_columns()
{
$layout = get_theme_mod('archive-layout', customizer_library_get_default('archive-layout'));
switch ($layout) {
case '4-column-masonry':
return '4';
case '3-column-masonry':
return '3';
case '2-column-masonry':
return '2';
default:
return '0';
}
}
示例7: bfg_customizer_build_styles
function bfg_customizer_build_styles()
{
if (get_theme_mod('custom-font', false)) {
// Heading font
$setting = 'heading-font';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
$stack = customizer_library_get_font_stack($mod);
if ($mod != customizer_library_get_default($setting)) {
Customizer_Library_Styles()->add(array('selectors' => array('.footer-widgets .widgettitle', '.widgettitle', '.h1', '.h2', '.h3', '.h4', '.h5', '.h6', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', '.widget_recent_entries li a'), 'declarations' => array('font-family' => $stack)));
}
// Body Font
$setting = 'body-font';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
$stack = customizer_library_get_font_stack($mod);
if ($mod != customizer_library_get_default($setting)) {
Customizer_Library_Styles()->add(array('selectors' => array('body', '.popover', '.tooltip', '.widget_recent_entries li span', '.site-header .site-description'), 'declarations' => array('font-family' => $stack)));
}
}
}
示例8: customizer_library_get_google_font_uri
/**
* Build the HTTP request URL for Google Fonts.
*
* @since 1.0.0.
*
* @return string The URL for including Google Fonts.
*/
function customizer_library_get_google_font_uri($fonts)
{
// De-dupe the fonts
$fonts = array_unique($fonts);
$allowed_fonts = customizer_library_get_google_fonts();
$family = array();
// Validate each font and convert to URL format
foreach ($fonts as $font) {
$font = trim($font);
// Verify that the font exists
if (array_key_exists($font, $allowed_fonts)) {
// Build the family name and variant string (e.g., "Open+Sans:regular,italic,700")
$family[] = urlencode($font . ':' . join(',', customizer_library_choose_google_font_variants($font, $allowed_fonts[$font]['variants'])));
}
}
// Convert from array to string
if (empty($family)) {
return '';
} else {
$request = '//fonts.googleapis.com/css?family=' . implode('%7C', $family);
}
// Load the font subset
$subset = get_theme_mod('font-subset', customizer_library_get_default('font-subset'));
if ('all' === $subset) {
$subsets_available = customizer_library_get_google_font_subsets();
// Remove the all set
unset($subsets_available['all']);
// Build the array
$subsets = array_keys($subsets_available);
} else {
$subsets = array('latin', $subset);
}
// Append the subset string
if (!empty($subsets)) {
$request .= urlencode('&subset=' . join(',', $subsets));
}
return esc_url($request);
}
示例9: customizer_library_demo_build_styles
/**
* Process user options to generate CSS needed to implement the choices.
*
* @since 1.0.0.
*
* @return void
*/
function customizer_library_demo_build_styles()
{
// Primary Color
$setting = 'primary-color';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
if ($mod !== customizer_library_get_default($setting)) {
$color = sanitize_hex_color($mod);
Customizer_Library_Styles()->add(array('selectors' => array('.primary'), 'declarations' => array('color' => $color)));
}
// Secondary Color
$setting = 'secondary-color';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
if ($mod !== customizer_library_get_default($setting)) {
$color = sanitize_hex_color($mod);
Customizer_Library_Styles()->add(array('selectors' => array('.secondary'), 'declarations' => array('color' => $color)));
}
// Border Color
$setting = 'border';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
if ($mod !== customizer_library_get_default($setting)) {
$color = sanitize_hex_color($mod);
Customizer_Library_Styles()->add(array('selectors' => array('.border'), 'declarations' => array('border-color' => $color)));
}
// Primary Font
$setting = 'primary-font';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
$stack = customizer_library_get_font_stack($mod);
if ($mod != customizer_library_get_default($setting)) {
Customizer_Library_Styles()->add(array('selectors' => array('.primary'), 'declarations' => array('font-family' => $stack)));
}
// Secondary Font
$setting = 'secondary-font';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
$stack = customizer_library_get_font_stack($mod);
if ($mod != customizer_library_get_default($setting)) {
Customizer_Library_Styles()->add(array('selectors' => array('.secondary'), 'declarations' => array('font-family' => $stack)));
}
}
示例10: body_class
body_class();
?>
>
<div id="page" class="hfeed site">
<a class="skip-link screen-reader-text" href="#content"><?php
_e('Skip to content', 'gateway');
?>
</a>
<div class="bg-image bg-image-header bg-center-center">
<div class="site-branding">
<?php
$header_logo = get_theme_mod('header_logo', customizer_library_get_default('header_logo'));
if (!$header_logo) {
?>
<h1 class="site-title"><a href="<?php
echo esc_url(home_url('/'));
?>
" rel="home" alt="<?php
bloginfo('name');
?>
"><?php
bloginfo('name');
?>
</a></h1>
<h2><?php
示例11: gather_styles
/**
* Process user options to generate CSS needed to implement the choices.
*
* @since 1.0.0.
*
* @return void
*/
function gather_styles()
{
// Primary Color
$setting = 'primary-color';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
if ($mod !== customizer_library_get_default($setting)) {
$color = sanitize_hex_color($mod);
$color_obj = new Jetpack_Color($color);
// Link Styling
Customizer_Library_Styles()->add(array('selectors' => array('a', '.site-title a'), 'declarations' => array('color' => $color)));
// Button Styling
Customizer_Library_Styles()->add(array('selectors' => array('button', '.button', 'input[type="button"]', 'input[type="reset"]', 'input[type="submit"]', '.masonry .entry-footer-meta a:hover'), 'declarations' => array('background-color' => $color)));
// Button Hover State
Customizer_Library_Styles()->add(array('selectors' => array('button:hover', '.button:hover', 'input[type="button"]:hover', 'input[type="reset"]:hover', 'input[type="submit"]:hover'), 'declarations' => array('background-color' => $color_obj->darken(5))));
// Border Colors
Customizer_Library_Styles()->add(array('selectors' => array('#content blockquote', '.page-header'), 'declarations' => array('border-color' => $mod)));
}
// Secondary Color
$setting = 'secondary-color';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
if ($mod !== customizer_library_get_default($setting)) {
// Colors
Customizer_Library_Styles()->add(array('selectors' => array('.site-title a:hover', '.bypostauthor .comment-author .fn:after'), 'declarations' => array('color' => sanitize_hex_color($color))));
}
// Primary Font
$setting = 'primary-font';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
$stack = customizer_library_get_font_stack($mod);
if ($mod != customizer_library_get_default($setting)) {
Customizer_Library_Styles()->add(array('selectors' => array('body', '.site-description', '.widget-title', '.comments-title', '#reply-title'), 'declarations' => array('font-family' => $stack)));
}
// Secondary Font
$setting = 'secondary-font';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
$stack = customizer_library_get_font_stack($mod);
if ($mod != customizer_library_get_default($setting)) {
Customizer_Library_Styles()->add(array('selectors' => array('h1, h2, h3, h4, h5, h6', '.comment-author'), 'declarations' => array('font-family' => $stack)));
}
// Menu Styling
$menus = array('primary', 'secondary');
foreach ($menus as $menu) {
if (!has_nav_menu($menu)) {
break;
}
if ($menu == 'primary') {
$selector = '#primary-navigation' . ' ';
}
if ($menu == 'secondary') {
$selector = '#secondary-navigation' . ' ';
}
// Background
$setting = $menu . '-menu-background';
$mod = get_theme_mod($setting, false);
if ($mod) {
Customizer_Library_Styles()->add(array('selectors' => array($selector, $selector . 'ul ul a:hover'), 'declarations' => array('background-color' => $mod)));
}
// Background Hover
$setting = $menu . '-menu-background-hover';
$mod = get_theme_mod($setting, false);
if ($mod) {
Customizer_Library_Styles()->add(array('selectors' => array($selector . 'a:hover', $selector . 'li:hover a'), 'declarations' => array('background-color' => $mod)));
}
// Navigation Text
$setting = $menu . '-menu-color';
$mod = get_theme_mod($setting, false);
if ($mod) {
Customizer_Library_Styles()->add(array('selectors' => array($selector . 'a', $selector . 'a:hover', $selector . 'li:hover a', $selector . '.dropdown-toggle:after'), 'declarations' => array('color' => $mod)));
}
// Border
$setting = $menu . '-menu-border';
$mod = get_theme_mod($setting, false);
if ($mod) {
Customizer_Library_Styles()->add(array('selectors' => array($selector . 'ul', $selector . 'a', $selector . '.dropdown-toggle', $selector . 'ul ul', $selector . 'ul ul a', $selector . 'ul li:hover ul a', $selector . 'ul ul ul'), 'declarations' => array('border-color' => $mod)));
}
}
// Header Background Color
$setting = 'header-background-color';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
if ($mod != customizer_library_get_default($setting)) {
Customizer_Library_Styles()->add(array('selectors' => array('.site-branding'), 'declarations' => array('background-color' => $mod)));
}
// Header Background Image
$setting = 'header-background-image';
$mod = get_theme_mod($setting, false);
if ($mod) {
Customizer_Library_Styles()->add(array('selectors' => array('.site-branding'), 'declarations' => array('background-image' => 'url(' . $mod . ')')));
}
// Header Background Image Styles
$setting = 'header-background-image-style';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
if ($mod != customizer_library_get_default($setting)) {
Customizer_Library_Styles()->add(array('selectors' => array('.site-branding'), 'declarations' => array('background-size' => 'auto auto', 'background-repeat' => 'repeat', 'background-position' => '0 0')));
}
//.........这里部分代码省略.........
示例12: customizer_library_smtm_build_styles
/**
* Process user options to generate CSS needed to implement the choices.
*
* @since 1.0.0.
*
* @return void
*/
function customizer_library_smtm_build_styles()
{
// Primary Color
$setting = 'primary-color';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
if ($mod !== customizer_library_get_default($setting)) {
$color = sanitize_hex_color($mod);
Customizer_Library_Styles()->add(array('selectors' => array('.primary', 'a', 'a:hover'), 'declarations' => array('color' => $color)));
Customizer_Library_Styles()->add(array('selectors' => array('a:hover'), 'declarations' => array('opacity' => 0.8)));
}
// Secondary Color
$setting = 'secondary-color';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
if ($mod !== customizer_library_get_default($setting)) {
$color = sanitize_hex_color($mod);
Customizer_Library_Styles()->add(array('selectors' => array('.secondary'), 'declarations' => array('color' => $color)));
}
// header Color
$setting = 'header-color';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
if ($mod !== customizer_library_get_default($setting)) {
$color = sanitize_hex_color($mod);
Customizer_Library_Styles()->add(array('selectors' => array('header.the-header'), 'declarations' => array('background-color' => $color)));
Customizer_Library_Styles()->add(array('selectors' => array('header.the-header .widget_nav_menu a:hover, header.the-header .widget_nav_menu .current-menu-item a'), 'declarations' => array('color' => $color)));
}
// footer Color
$setting = 'footer-color';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
if ($mod !== customizer_library_get_default($setting)) {
$color = sanitize_hex_color($mod);
Customizer_Library_Styles()->add(array('selectors' => array('footer'), 'declarations' => array('background-color' => $color)));
}
// Background Color
$setting = 'background-color';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
if ($mod !== customizer_library_get_default($setting)) {
$color = sanitize_hex_color($mod);
Customizer_Library_Styles()->add(array('selectors' => array('body, html'), 'declarations' => array('background-color' => $color)));
}
// Primary Font
$setting = 'primary-font';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
$stack = customizer_library_get_font_stack($mod);
if ($mod != customizer_library_get_default($setting)) {
Customizer_Library_Styles()->add(array('selectors' => array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', '.widget-title', '.title'), 'declarations' => array('font-family' => $stack)));
}
// Secondary Font
$setting = 'secondary-font';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
$stack = customizer_library_get_font_stack($mod);
if ($mod != customizer_library_get_default($setting)) {
Customizer_Library_Styles()->add(array('selectors' => array('p', 'span', 'div', 'a'), 'declarations' => array('font-family' => $stack)));
}
// Special Font
$setting = 'tertiary-font';
$mod = get_theme_mod($setting, customizer_library_get_default($setting));
$stack = customizer_library_get_font_stack($mod);
if ($mod != customizer_library_get_default($setting)) {
Customizer_Library_Styles()->add(array('selectors' => array('.widget_site_name_widget > a > h1', '.special'), 'declarations' => array('font-family' => $stack)));
}
}
示例13: dynamic_sidebar
dynamic_sidebar('footer');
?>
</div>
</div><!-- .footer-widgets -->
<?php
}
?>
<footer id="colophon" class="site-footer" role="contentinfo">
<div class="col-width">
<?php
if (get_theme_mod('footer-text', customizer_library_get_default('footer-text')) != '') {
?>
<div class="site-info">
<?php
echo get_theme_mod('footer-text', customizer_library_get_default('footer-text'));
?>
</div><!-- .site-info -->
<?php
}
?>
</div><!-- .col-width -->
</footer><!-- #colophon -->
</div><!-- #page -->
<?php
wp_footer();
?>
</body>
示例14: gather_fonts
/**
* Enqueue fonts.
*/
function gather_fonts()
{
// Font options
$fonts = array();
// Site title font only required when logo not in use
if (!get_theme_mod('logo', 0)) {
$fonts[0] = get_theme_mod('site-title-font', customizer_library_get_default('site-title-font'));
}
$fonts[1] = get_theme_mod('primary-font', customizer_library_get_default('primary-font'));
$fonts[2] = get_theme_mod('secondary-font', customizer_library_get_default('secondary-font'));
$font_uri = customizer_library_get_google_font_uri($fonts);
// Load Google Fonts
wp_enqueue_style('gather-body-fonts', $font_uri, array(), null, 'screen');
// Icon Font
wp_enqueue_style('gather-icons', get_template_directory_uri() . '/fonts/gather-icons.css', array(), '0.4.0');
}
示例15: get_theme_mod
}
?>
</div>
</div><!-- .row -->
<div class="row">
<div class="large-12 columns">
<hr>
<div class="copyright-info">
<?php
$footer_copyright = get_theme_mod('footer_copyright', customizer_library_get_default('footer_copyright'));
echo wp_kses($footer_copyright, array('strong' => array(), 'a' => array('href' => array(), 'title' => array())));
?>
</div><!-- .copyright-info -->
</div><!-- .large-12 -->
</div><!-- .row -->
</footer><!-- #colophon -->
</div><!-- .footer-wrap -->
<?php
wp_footer();