本文整理汇总了PHP中get_background_image函数的典型用法代码示例。如果您正苦于以下问题:PHP get_background_image函数的具体用法?PHP get_background_image怎么用?PHP get_background_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_background_image函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: contango_custom_background_callback
/**
* This is a fix for when a user sets a custom background color with no custom background image. What
* happens is the theme's background image hides the user-selected background color. If a user selects a
* background image, we'll just use the WordPress custom background callback.
*
* @link http://core.trac.wordpress.org/ticket/16919
*/
function contango_custom_background_callback()
{
/* Get the background image. */
$image = get_background_image();
/* If there's an image, just call the normal WordPress callback. We won't do anything here. */
if (!empty($image)) {
_custom_background_cb();
return;
}
/* Get the background color. */
$color = get_background_color();
/* If no background color, return. */
if (empty($color)) {
return;
}
/* Use 'background' instead of 'background-color'. */
$style = "background: #{$color};";
?>
<style type="text/css">body.custom-background { <?php
echo trim($style);
?>
}</style>
<?php
}
示例2: dusktodawn_custom_background
function dusktodawn_custom_background()
{
if ('' != get_background_image()) {
?>
<style type="text/css">
#super-super-wrapper,
#super-wrapper,
#page,
.right-sidebar #page {
background: none;
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
</style>
<?php
} elseif ('' != get_background_color()) {
?>
<style type="text/css">
#super-super-wrapper {
background: none;
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
</style>
<?php
}
}
示例3: ebor_load_scripts
/**
* Ebor Load Scripts
* Properly Enqueues Scripts & Styles for the theme
* @since version 1.0
* @author TommusRhodus
*/
function ebor_load_scripts()
{
$protocol = is_ssl() ? 'https' : 'http';
//Enqueue Styles
wp_enqueue_style('ebor-loom-raleway-font', "{$protocol}://fonts.googleapis.com/css?family=Raleway:400,300,500,600,700,800,900");
wp_enqueue_style('ebor-bootstrap', get_template_directory_uri() . '/style/css/bootstrap.css');
wp_enqueue_style('ebor-owl', get_template_directory_uri() . '/style/css/owl.carousel.css');
wp_enqueue_style('ebor-fancybox', get_template_directory_uri() . '/style/js/fancybox/jquery.fancybox.css');
wp_enqueue_style('ebor-fancybox-thumbs', get_template_directory_uri() . '/style/js/fancybox/helpers/jquery.fancybox-thumbs.css?v=1.0.2');
if (class_exists('Woocommerce')) {
wp_enqueue_style('ebor-woocommerce', get_template_directory_uri() . '/style/css/woocommerce.css');
}
wp_enqueue_style('ebor-style', get_stylesheet_uri());
wp_enqueue_style('ebor-fonts', get_template_directory_uri() . '/style/type/fonts.css');
wp_enqueue_style('ebor-custom', get_template_directory_uri() . '/custom.css');
//Dequeue Styles
wp_dequeue_style('aqpb-view-css');
wp_deregister_style('aqpb-view-css');
//Enqueue Scripts
wp_enqueue_script('ebor-bootstrap', get_template_directory_uri() . '/style/js/bootstrap.min.js', array('jquery'), false, true);
if (is_ssl()) {
wp_enqueue_script('ebor-googlemapsapi', 'https://maps-api-ssl.google.com/maps/api/js?sensor=false&v=3.exp', array('jquery'), false, true);
} else {
wp_enqueue_script('ebor-googlemapsapi', 'http://maps.googleapis.com/maps/api/js?sensor=false&v=3.exp', array('jquery'), false, true);
}
wp_enqueue_script('ebor-plugins', get_template_directory_uri() . '/style/js/plugins.js', array('jquery'), false, true);
wp_enqueue_script('ebor-scripts', get_template_directory_uri() . '/style/js/scripts.js', array('jquery'), false, true);
//Enqueue Comments
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
/**
* Dequeue Scripts
*/
wp_dequeue_script('aqpb-view-js');
wp_deregister_script('aqpb-view-js');
/**
* localize script
*/
$script_data = array('fixed_header' => get_option('fixed_header', '1'), 'site_version' => get_option('site_version', 'multipage'));
wp_localize_script('ebor-scripts', 'wp_data', $script_data);
/**
* Pass theme options to CSS
*/
$highlight = get_option('highlight_colour', '#1abb9c');
$highlightrgb = ebor_hex2rgb($highlight);
$highlight_hover = get_option('highlight_hover_colour', '#17a78b');
$dark_wrapper = get_option('wrapper_background_dark', '#f5f5f5');
$header_bg = get_option('header_bg', '#f5f5f5');
$header_dropdown_bg = get_option('header_dropdown_bg', '#414141');
$footer_bg = get_option('footer_bg', '#303030');
$sub_footer_bg = get_option('sub_footer_bg', '#2d2d2d');
$header_bg_rgb = ebor_hex2rgb($header_bg);
$custom_styles = "\n\t\t/**\n\t\t * Header\n\t\t */\n\t\t.navbar-header {\n\t\t\tbackground: {$header_bg};\n\t\t\tborder-top: 3px solid {$header_dropdown_bg};\n\t\t}\n\t\t\n\t\t.navbar.basic.fixed .navbar-header {\n\t\t\tbackground: rgba({$header_bg_rgb},0.94);\n\t\t}\n\t\t\n\t\t.navbar .dropdown-menu {\n\t\t\tbackground: {$header_dropdown_bg};\n\t\t}\n\t\t\n\t\t/**\n\t\t * Footer\n\t\t */\n\t\t.footer {\n\t\t\tbackground: {$footer_bg};\n\t\t}\n\t\t\n\t\t.sub-footer {\n\t\t\tbackground: {$sub_footer_bg};\n\t\t}\n\t\t\n\t\t/**\n\t\t * Page Wrappers Backgounds\n\t\t */\n\t\t.light-wrapper,\n\t\t#sub-header.sub-footer.social-light {\n\t\t background: #" . get_background_color() . ";\n\t\t}\n\t\t.dark-wrapper,\n\t\t#sub-header.sub-footer.social-line {\n\t\t background: {$dark_wrapper};\n\t\t}\n\t\t\n\t\t/**\n\t\t * Highlight Colours\n\t\t */\n\t\t.spinner,\n\t\t.tp-loader,\n\t\t#fancybox-loading div {\n\t\t border-left: 3px solid rgba({$highlightrgb},.15) !important;\n\t\t border-right: 3px solid rgba({$highlightrgb},.15) !important;\n\t\t border-bottom: 3px solid rgba({$highlightrgb},.15) !important;\n\t\t border-top: 3px solid rgba({$highlightrgb},.8) !important;\n\t\t}\n\t\ta,\n\t\t.colored,\n\t\t.post-title a:hover,\n\t\tul.circled li:before,\n\t\taside ul li:before,\n\t\t.lead.lite a:hover,\n\t\t.footer a:hover,\n\t\t.nav > li > a:hover,\n\t\t.nav > li.current > a,\n\t\t.navbar .nav .open > a,\n\t\t.navbar .nav .open > a:hover,\n\t\t.navbar .nav .open > a:focus,\n\t\t.navbar .dropdown-menu > li > a:hover,\n\t\t.navbar .dropdown-menu > li > a:focus,\n\t\t.navbar .dropdown-submenu:hover > a,\n\t\t.navbar .dropdown-submenu:focus > a,\n\t\t.navbar .dropdown-menu > .active > a,\n\t\t.navbar .dropdown-menu > .active > a:hover,\n\t\t.navbar .dropdown-menu > .active > a:focus,\n\t\t.filter li a:hover,\n\t\t.filter li a.active,\n\t\tul.circled li:before, \n\t\t.widget_categories ul li:before,\n\t\t.post-content ul li:before,\n\t\t.textwidget a,\n\t\t#sub-header .pull-left i,\n\t\t#sub-header.sub-footer.social-line .pull-left a:hover,\n\t\t#sub-header.sub-footer.social-light .pull-left a:hover,\n\t\t#menu-standard-navigation a.active {\n\t\t color: {$highlight};\n\t\t}\n\t\t.lead.lite a {\n\t\t border-bottom: 1px solid {$highlight};\n\t\t}\n\t\t.btn,\n\t\t.parallax .btn-submit,\n\t\t.btn-submit,\n\t\t.newsletter-wrapper #mc_embed_signup .button,\n\t\t.widget_ns_mailchimp form input[type='submit'],\n\t\tinput[type='submit'],\n\t\t.bonfire-slideout-content input[type='submit'],\n\t\tinput[type='button'],\n\t\t.woocommerce .widget_price_filter .ui-slider-horizontal .ui-slider-range, .woocommerce-page .widget_price_filter .ui-slider-horizontal .ui-slider-range,\n\t\t.woocommerce span.onsale, .woocommerce-page span.onsale, .woocommerce ul.products li.product .onsale, .woocommerce-page ul.products li.product .onsale,\n\t\t.woocommerce .button,\n\t\t.added_to_cart,\n\t\t.ebor-count {\n\t\t background: {$highlight};\n\t\t}\n\t\t.btn:hover,\n\t\t.btn:focus,\n\t\t.btn:active,\n\t\t.btn.active,\n\t\t.parallax .btn-submit:hover,\n\t\tinput[type='submit']:hover,\n\t\t.bonfire-slideout-content input[type='submit']:hover,\n\t\t.widget_ns_mailchimp form input[type='submit']:hover,\n\t\tinput[type='button']:hover,\n\t\t.woocommerce .button:hover,\n\t\t.added_to_cart:hover,\n\t\t.woocommerce .widget_price_filter .ui-slider .ui-slider-handle, .woocommerce-page .widget_price_filter .ui-slider .ui-slider-handle {\n\t\t background: {$highlight_hover};\n\t\t}\n\t\t.tooltip-inner {\n\t\t background-color: {$highlight};\n\t\t}\n\t\t.tooltip.top .tooltip-arrow,\n\t\t.tooltip.top-left .tooltip-arrow,\n\t\t.tooltip.top-right .tooltip-arrow {\n\t\t border-top-color: {$highlight}\n\t\t}\n\t\t.tooltip.right .tooltip-arrow {\n\t\t border-right-color: {$highlight}\n\t\t}\n\t\t.tooltip.left .tooltip-arrow {\n\t\t border-left-color: {$highlight}\n\t\t}\n\t\t.tooltip.bottom .tooltip-arrow,\n\t\t.tooltip.bottom-left .tooltip-arrow,\n\t\t.tooltip.bottom-right .tooltip-arrow {\n\t\t border-bottom-color: {$highlight}\n\t\t}\n\t\t.services-1 .col-wrapper:hover,\n\t\t.services-1 .col-wrapper:hover:before,\n\t\t.woocommerce .price {\n\t\t border-color: {$highlight} !important;\n\t\t}\n\t\t.services-3 .icon i.icn {\n\t\t color: {$highlight};\n\t\t border: 2px solid {$highlight};\n\t\t}\n\t\t.services-3 .col:hover i.icn {\n\t\t background-color: {$highlight};\n\t\t}\n\t\t.panel-title > a:hover {\n\t\t color: {$highlight}\n\t\t}\n\t\t.progress-list li em {\n\t\t color: {$highlight};\n\t\t}\n\t\t.progress.plain,\n\t\t.woocommerce .widget_price_filter .price_slider_wrapper .ui-widget-content, .woocommerce-page .widget_price_filter .price_slider_wrapper .ui-widget-content {\n\t\t border: 1px solid {$highlight};\n\t\t}\n\t\t.progress.plain .bar {\n\t\t background: {$highlight};\n\t\t}\n\t\t.meta.tags a:hover {\n\t\t color: {$highlight}\n\t\t}\n\t\t.owl-carousel .owl-controls .owl-prev:hover,\n\t\t.owl-carousel .owl-controls .owl-next:hover {\n\t\t border: 1px solid {$highlight};\n\t\t color: {$highlight};\n\t\t}\n\t\t.navigation a:hover {\n\t\t border: 1px solid {$highlight};\n\t\t color: {$highlight};\n\t\t}\n\t\t.tp-caption a,\n\t\t#testimonials .author,\n\t\t.tabs-top .tab a:hover,\n\t\t.tabs-top .tab.active a {\n\t\t color: {$highlight}\n\t\t}\n\t\t.parallax a:hover {\n\t\t color: {$highlight_hover}\n\t\t}\n\t\t.pagination ul > li > a:hover,\n\t\t.pagination ul > li > a:focus,\n\t\t.pagination ul > .active > a,\n\t\t.pagination ul > .active > span {\n\t\t border: 1px solid {$highlight};\n\t\t color: {$highlight};\n\t\t}\n\t\t.sidebox a:hover {\n\t\t color: {$highlight}\n\t\t}\n\t\t#comments .info h2 a:hover {\n\t\t color: {$highlight}\n\t\t}\n\t\t#comments a.reply-link:hover {\n\t\t color: {$highlight}\n\t\t}\n\t\t.pricing .plan h4 span {\n\t\t color: {$highlight}\n\t\t}\n\t\t.bonfire-slideout-button:hover {\n\t\t\tcolor: {$highlight};\n\t\t}\n\t\t.bonfire-slideout-close:hover,\n\t\t.woocommerce .button:hover,\n\t\t.added_to_cart:hover,\n\t\t.woocommerce .price,\n\t\t.woocommerce-tabs ul.tabs li a:hover,\n\t\t.woocommerce-tabs ul.tabs li.active a {\n\t\t\tcolor: {$highlight} !important;\n\t\t}\n\t\t.bonfire-slideout-content .btn-submit {\n\t\t background: {$highlight}\n\t\t}\n\t\t@media (max-width: 991px) { \n\t\t\t.navbar-nav > li > a,\n\t\t\t.navbar-nav > li > a:focus {\n\t\t\t color: {$highlight}\n\t\t\t}\n\t\t}\n\t";
if (get_background_image()) {
$custom_styles .= "\n\t\t\t.light-wrapper {\n\t\t\t background: none;\n\t\t\t}\n\t\t";
}
wp_add_inline_style('ebor-style', $custom_styles);
wp_add_inline_style('ebor-style', get_option('custom_css'));
}
示例4: toivo_lite_custom_background_callback
/**
* This is a fix for when a user sets a custom background color with no custom background image. What
* happens is the theme's background image hides the user-selected background color. If a user selects a
* background image, we'll just use the WordPress custom background callback. This also fixes WordPress
* not correctly handling the theme's default background color.
*
* @link http://core.trac.wordpress.org/ticket/16919
* @link http://core.trac.wordpress.org/ticket/21510
* @author Justin Tadlock, justintadlock.com
* @link http://themehybrid.com/themes/stargazer
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* @since 1.0.0
* @access public
* @return void
*/
function toivo_lite_custom_background_callback()
{
/* Get the background image. */
$image = get_background_image();
/* If there's an image, just call the normal WordPress callback. We won't do anything here. */
if (!empty($image)) {
_custom_background_cb();
return;
}
/* Get the background color. */
$color = get_background_color();
/* If no background color, return. */
if (empty($color)) {
return;
}
/* Use 'background' instead of 'background-color'. */
$style = "background: #{$color};";
?>
<style type="text/css" id="custom-background-css">body.custom-background { <?php
echo trim($style);
?>
}</style>
<?php
/* Add custom-background body class if we get this far. */
add_filter('body_class', 'toivo_lite_add_custom_background_class');
}
示例5: utility_pro_enqueue_assets
/**
* Enqueue theme assets.
*
* @since 1.0.0
*/
function utility_pro_enqueue_assets()
{
// Replace style.css with style-rtl.css for RTL languages
//wp_style_add_data( 'utility-pro', 'rtl', 'replace' );
// Load mobile responsive menu
/* wp_enqueue_script( 'utility-pro-responsive-menu', get_stylesheet_directory_uri() . '/js/responsive-menu.js', array( 'jquery' ), null, true );
$localize = array(
'buttonText' => __( 'Menu', 'utility-pro' ),
'buttonLabel' => __( 'Primary Navigation Menu', 'utility-pro' ),
'subButtonText' => __( 'Menu', 'utility-pro' ),
'subButtonLabel' => __( 'Sub Navigation Menu', 'utility-pro' ),
);
// Localize the responsive menu script (for translation)
wp_localize_script( 'utility-pro-responsive-menu', 'utilityResponsiveL10n', $localize );
// Keyboard navigation (dropdown menus) script
wp_enqueue_script( 'genwpacc-dropdown', get_stylesheet_directory_uri() . '/js/genwpacc-dropdown.js', array( 'jquery' ), null , true );
*/
// Load skiplink scripts only if Genesis Accessible plugin is not active
if (!utility_pro_genesis_accessible_is_active()) {
wp_enqueue_script('genwpacc-skiplinks-js', get_stylesheet_directory_uri() . '/js/genwpacc-skiplinks.js', array(), null, true);
}
// Load remaining scripts only if custom background is being used
// and we're on the home page or a page using the landing page template
if (!get_background_image() || !(is_front_page() || is_page_template() || is_single() || is_archive())) {
return;
}
wp_enqueue_script('utility-pro-backstretch', get_stylesheet_directory_uri() . '/js/backstretch.min.js', array('jquery'), null, true);
wp_enqueue_script('utility-pro-backstretch-args', get_stylesheet_directory_uri() . '/js/backstretch.args.js', array('utility-pro-backstretch'), null, true);
wp_localize_script('utility-pro-backstretch-args', 'utilityBackstretchL10n', array('src' => secondaryimageheader()));
}
示例6: custom_background
function custom_background()
{
$bg_image_url = get_background_image();
$bg_color = get_background_color();
// If the user has not defined a background
// color or a background image, we stop.
if (!$bg_image_url && !$bg_color) {
return;
}
// If there is only a background color defined,
// we apply it to <body>, then we stop.
if (!$bg_image_url && $bg_color) {
echo '<style>
body {
background-color: #' . $bg_color . ';
}
</style>';
return;
}
echo '<style>
body {
background-color: #' . $bg_color . ';
background-image: url(' . $bg_image_url . ');
background-repeat: ' . get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat')) . ';
background-position: ' . get_theme_mod('background_position_x', get_theme_support('custom-background', 'default-position-x')) . ';
background-attachment: ' . get_theme_mod('background_attachment', get_theme_support('custom-background', 'default-attachment')) . '
}
</style>';
}
示例7: engage_site_header_banner
function engage_site_header_banner()
{
if (!get_background_image()) {
return;
}
echo '<div class="site-header-banner"></div>';
}
示例8: shandora_background_style
function shandora_background_style()
{
$background_image = set_url_scheme(get_background_image());
$color = get_theme_mod('background_color');
$style = $color ? "background-color: #{$color};" : '';
$image = $background_image ? " background-image: url('{$background_image}');" : '';
$repeat = get_theme_mod('background_repeat', 'repeat');
if (!in_array($repeat, array('no-repeat', 'repeat-x', 'repeat-y', 'repeat'))) {
$repeat = 'repeat';
}
$repeat = " background-repeat: {$repeat};";
$position = get_theme_mod('background_position_x', 'left');
if (!in_array($position, array('center', 'right', 'left'))) {
$position = 'left';
}
$position = " background-position: top {$position};";
$attachment = get_theme_mod('background_attachment', 'scroll');
if (!in_array($attachment, array('fixed', 'scroll'))) {
$attachment = 'scroll';
}
$attachment = " background-attachment: {$attachment};";
$style .= $image . $repeat . $position . $attachment;
// If we get this far, we have custom styles.
?>
<style type="text/css" id="shandora-background-css">
body.custom-background {
<?php
echo trim($style);
?>
}
</style>
<?php
}
示例9: pilcrow_background_markup
/**
* Adds a containing div around everything if the custom background feature is in use
*
* @since Pilcrow 1.0
*/
function pilcrow_background_markup()
{
// check if we're using a custom background image or color
if ('' != get_background_color() || '' != get_background_image()) {
add_action('pilcrow_before', 'pilcrow_wrap_before');
add_action('pilcrow_after', 'pilcrow_wrap_after');
}
}
示例10: piratenkleider_custom_background_cb
/**
* piratenkleider custom background callback.
*
*/
function piratenkleider_custom_background_cb()
{
global $defaultoptions;
global $options;
// $background is the saved custom image, or the default image.
$background = set_url_scheme(get_background_image());
// $color is the saved custom color.
// A default has to be specified in style.css. It will not be printed here.
$color = get_theme_mod('background_color');
if (!$background && !$color) {
return;
}
if (!isset($options['1april-prank'])) {
$options['1april-prank'] = $defaultoptions['1april-prank'];
}
if (!isset($options['1april-header-image'])) {
$options['1april-header-image'] = $defaultoptions['1april-header-image'];
}
if (!isset($options['1april-prank-day'])) {
$options['1april-prank-day'] = $defaultoptions['1april-prank-day'];
}
$style = $color ? "background-color: #{$color};" : '';
if ($background) {
$image = " background-image: url('{$background}');";
if ($options['1april-prank'] == "1" && date('m-d') == $options['1april-prank-day']) {
$image = " background-image: url('" . $options['1april-header-image'] . "');";
$style = "background-color: #fff; ";
}
$repeat = get_theme_mod('background_repeat', 'repeat-x');
if (!in_array($repeat, array('no-repeat', 'repeat-x', 'repeat-y', 'repeat'))) {
$repeat = 'repeat-x';
}
$repeat = " background-repeat: {$repeat};";
$positionx = get_theme_mod('background_position_x', 'left');
if (!in_array($positionx, array('center', 'right', 'left'))) {
$positionx = 'left';
}
$positiony = get_theme_mod('background_position_y', 'bottom');
if (!in_array($positiony, array('top', 'bottom'))) {
$positiony = 'bottom';
}
$position = " background-position: {$positionx} {$positiony};";
$attachment = get_theme_mod('background_attachment', 'scroll');
if (!in_array($attachment, array('fixed', 'scroll'))) {
$attachment = 'scroll';
}
$attachment = " background-attachment: {$attachment};";
$style .= $image . $repeat . $position . $attachment;
}
?>
<style type="text/css" id="custom-background-css">
.header { <?php
echo trim($style);
?>
}
</style>
<?php
}
示例11: update_color_control
public function update_color_control()
{
//for update global options
global $wedding_style_color_control_page;
foreach ($wedding_style_color_control_page->options_colorcontrol as $value) {
${$value}['var_name'] = $value['std'];
}
$background_color = get_background_color();
$background_image = get_background_image();
}
示例12: genesischild_backstretch_background_scripts
function genesischild_backstretch_background_scripts()
{
//* Load scripts only if custom background is being used
if (!get_background_image()) {
return;
}
wp_enqueue_script('backstretch', get_stylesheet_directory_uri() . '/js/backstretch.min.js', array('jquery'), '2.0.4', true);
wp_enqueue_script('backstretch-image', get_stylesheet_directory_uri() . '/js/backstretch-initialise.js', array('jquery', 'backstretch'), '1', true);
wp_localize_script('backstretch-image', 'BackStretchImage', array('src' => get_background_image()));
}
示例13: agency_enqueue_backstretch_scripts
function agency_enqueue_backstretch_scripts()
{
//* Load scripts only if custom background is being used
if (!get_background_image()) {
return;
}
wp_enqueue_script('agency-pro-backstretch', get_bloginfo('stylesheet_directory') . '/js/backstretch.js', array('jquery'), '1.0.0');
wp_enqueue_script('agency-pro-backstretch-set', get_bloginfo('stylesheet_directory') . '/js/backstretch-set.js', array('jquery', 'agency-pro-backstretch'), '1.0.0');
wp_localize_script('agency-pro-backstretch-set', 'BackStretchImg', array('src' => str_replace('http:', '', get_background_image())));
}
示例14: cyberchimps_custom_background_cb
function cyberchimps_custom_background_cb()
{
// $background is the saved custom image, or the default image.
$background = get_background_image();
// $color is the saved custom color.
// A default has to be specified in style.css. It will not be printed here.
$color = get_theme_mod('background_color');
// CyberChimps background image
$cc_background = get_theme_mod('cyberchimps_background');
if (!$background && !$color && !$cc_background) {
return;
}
$style = $color ? "background-color: #{$color};" : '';
if ($background) {
$image = " background-image: url('{$background}');";
$repeat = get_theme_mod('background_repeat', 'repeat');
if (!in_array($repeat, array('no-repeat', 'repeat-x', 'repeat-y', 'repeat'))) {
$repeat = 'repeat';
}
$repeat = " background-repeat: {$repeat};";
$position = get_theme_mod('background_position_x', 'left');
if (!in_array($position, array('center', 'right', 'left'))) {
$position = 'left';
}
$position = " background-position: top {$position};";
$attachment = get_theme_mod('background_attachment', 'scroll');
if (!in_array($attachment, array('fixed', 'scroll'))) {
$attachment = 'scroll';
}
$attachment = " background-attachment: {$attachment};";
$style .= $image . $repeat . $position . $attachment;
}
if (!$background && !$color && $cc_background != 'none') {
$img_url = get_template_directory_uri() . '/cyberchimps/lib/images/backgrounds/' . $cc_background . '.jpg';
$image = "background-image: url( '{$img_url}' );";
$style .= $image;
?>
<style type="text/css">
body { <?php
echo trim($style);
?>
}
</style>
<?php
} else {
?>
<style type="text/css" id="custom-background-css">
body.custom-background { <?php
echo trim($style);
?>
}
</style>
<?php
}
}
示例15: tinyframework_body_class
/**
* Extend the default WordPress `<body>` CSS classes to denote:
*
* @since Tiny Framework 1.0
*
* param array $classes Existing class values.
*
* @return array Filtered class values.
*/
function tinyframework_body_class($classes)
{
$background_color = get_background_color();
$background_image = get_background_image();
// Using a full-width layout, when no active widgets in the sidebar or full-width template.
if (!is_active_sidebar('sidebar-1') || is_page_template('page-templates/full-width.php') || is_attachment()) {
$classes[] = 'full-width';
}
// Front Page template: thumbnail in use and number of sidebars for widget areas.
if (is_page_template('page-templates/front-page.php')) {
$classes[] = 'template-front-page';
if (has_post_thumbnail()) {
$classes[] = 'has-post-thumbnail';
}
if (is_active_sidebar('sidebar-2') && is_active_sidebar('sidebar-3')) {
$classes[] = 'two-sidebars';
}
}
// White or empty background color to change the layout and spacing.
if (empty($background_image)) {
if (empty($background_color)) {
$classes[] = 'custom-background-empty';
} elseif (in_array($background_color, array('fff', 'ffffff'))) {
$classes[] = 'custom-background-white';
}
}
// Enable custom font class only if the font CSS is queued to load.
if (wp_style_is('tinyframework-fonts', 'queue')) {
$classes[] = 'custom-font-enabled';
}
// Single or multiple authors.
if (!is_multi_author()) {
$classes[] = 'single-author';
}
// Index, archive views.
if (is_archive() || is_search() || is_home()) {
$classes[] = 'list-view';
}
// Single views. is_singular applies when one of the following returns true: is_single(), is_page() or is_attachment()
if (is_singular() && !is_front_page()) {
$classes[] = 'singular';
}
// Presence of header image.
if (get_header_image()) {
$classes[] = 'header-image-yes';
} else {
$classes[] = 'header-image-no';
}
// Presence of footer widget(s).
if (is_active_sidebar('sidebar-4') || is_active_sidebar('sidebar-5') || is_active_sidebar('sidebar-6')) {
$classes[] = 'footer-widgets';
}
return $classes;
}