/** * 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 }
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 } }
/** * 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')); }
/** * 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'); }
/** * 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())); }
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>'; }
function engage_site_header_banner() { if (!get_background_image()) { return; } echo '<div class="site-header-banner"></div>'; }
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 }
/** * 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'); } }
/** * 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 }
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(); }
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())); }
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()))); }
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 } }
/** * 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; }
function sixteen_nine_enqueue_scripts() { wp_enqueue_script('sixteen-nine-responsive-menu', get_bloginfo('stylesheet_directory') . '/js/responsive-menu.js', array('jquery'), '1.0.0'); //* Load scripts only if custom background is being used if (!get_background_image()) { return; } wp_enqueue_script('sixteen-nine-backstretch', get_bloginfo('stylesheet_directory') . '/js/backstretch.js', array('jquery'), '1.0.0'); wp_enqueue_script('sixteen-nine-backstretch-set', get_bloginfo('stylesheet_directory') . '/js/backstretch-set.js', array('jquery', 'sixteen-nine-backstretch'), '1.0.0'); wp_localize_script('sixteen-nine-backstretch-set', 'BackStretchImg', array('src' => get_background_image())); }
function minimum_enqueue_backstretch() { //* Load scripts only if custom background is being used if (!get_background_image()) { return; } //* Load Backstretch scripts wp_enqueue_script('minimum-backstretch', get_bloginfo('stylesheet_directory') . '/js/backstretch.js', array('jquery'), '1.0.0'); wp_enqueue_script('minimum-backstretch-set', get_bloginfo('stylesheet_directory') . '/js/backstretch-set.js', array('jquery', 'minimum-backstretch'), '1.0.0'); wp_localize_script('minimum-backstretch-set', 'BackStretchImg', array('src' => get_background_image())); }
function modularity_custom_background_color() { if (get_background_image() == '' && get_background_color() != '') { ?> <style type="text/css"> body { background-image: none; } </style> <?php } }
function meso_add_container_style() { $bg_image = get_background_image(); $bg_color = get_background_color(); $header_image = get_header_image(); if ($bg_image || $bg_color) { ?> .container-wrap, footer .ftop {float: left;margin: 0;padding: 2% 2% 0 2%;width: 96%;background-color:white;} #header {background:white;}footer.footer-bottom {background:transparent none !important;}.fbottom {background-color: #52C0D4;color:#fff !important;width: 96%;margin: 0;padding: 0.6em 2% !important;}#siteinfo {margin:0 0 0 1.6em;}@media only screen and (min-width:300px) and (max-width:770px){.container-wrap, #custom footer .ftop {float: left;margin: 0;padding: 2% !important;width: 96% !important;background-color:white;}#custom-img-header {margin:0 0 2em;}} <?php } }
/** * Extend the default WordPress body classes. * * @since Agama 1.0.0 * @param array $classes Existing class values. * @return array Filtered class values. */ function body_class($classes) { $background_color = get_background_color(); $background_image = get_background_image(); $header = get_theme_mod('agama_header_style', 'default'); $sidebar_position = get_theme_mod('agama_sidebar_position', 'right'); $blog_layout = get_theme_mod('agama_blog_layout', 'list'); // If header "sticky" if ($header == 'sticky') { $classes[] = 'sticky_header'; } // If sidebar position "left" if ($sidebar_position == 'left') { $classes[] = 'sidebar_left'; } // If blog layout "small_thumbs" if ($blog_layout == 'small_thumbs') { $classes[] = 'blog_small_thumbs'; } // If blog layout "grid" if ($blog_layout == 'grid') { $classes[] = 'blog_grid'; } // If page template "full-width" if (is_page_template('page-templates/full-width.php')) { $classes[] = 'full-width'; } // If page template "front-page" if (is_page_template('page-templates/front-page.php')) { $classes[] = 'template-front-page'; if (has_post_thumbnail()) { $classes[] = 'has-post-thumbnail'; } } // If empty background 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('PTSans', 'queue')) { $classes[] = 'custom-font-enabled'; } // Single Author if (!is_multi_author()) { $classes[] = 'single-author'; } return $classes; }
function minimum_front_page_enqueue_scripts() { //* Load scripts only if custom background is being used if (!get_background_image()) { return; } //* Enqueue Backstretch scripts wp_enqueue_script('minimum-backstretch', get_bloginfo('stylesheet_directory') . '/js/backstretch.js', array('jquery'), '1.0.0'); wp_enqueue_script('minimum-backstretch-set', get_bloginfo('stylesheet_directory') . '/js/backstretch-set.js', array('jquery', 'minimum-backstretch'), '1.0.0'); wp_localize_script('minimum-backstretch-set', 'BackStretchImg', array('src' => str_replace('http:', '', get_background_image()))); //* Add custom body class add_filter('body_class', 'minimum_add_body_class'); }
/** * Helper for form(). Create radio input fields * * @return string */ protected function get_radio_fields() { $value = get_background_image() ? 'none' : get_theme_mod($this->option, 'none'); $radios = array('none', 'noise', 'blue', 'dark', 'space', 'debut_light', 'silk', 'grid'); $html = '<div class="images-radio-container"><label for="choose-from-library-link">' . __('Or choose one of CyberChimps background images', 'cyberchimps_core') . '</label><br>'; foreach ($radios as $radio) { $html .= '<div class="images-radio-subcontainer">'; $html .= sprintf(' <input type="radio" class="of-radio-img-radio" name="%1$s" style="display:none;" value="%2$s" id="%3$s"%4$s>', $this->option, $radio, "{$this->option}-{$radio}", addslashes(checked($value, $radio, false))); $selected = $value == $radio ? ' of-radio-img-selected' : ''; $html .= '<img src="' . get_template_directory_uri() . '/cyberchimps/lib/images/backgrounds/thumbs/' . $radio . '.png" class="of-radio-img-img' . $selected . '" alt="' . $radio . '" title="' . $radio . '" />'; $html .= '</div>'; } return "{$html}</div>"; }
/** * Adds custom classes to the array of body classes. * * @param array $classes Classes for the body element. * @return array */ function illustratr_body_classes($classes) { // Adds a class of body-borders to blogs with default background settings. if (!get_background_image()) { $classes[] = 'body-borders'; } // Adds a class of group-blog to blogs with more than 1 published author. if (is_multi_author()) { $classes[] = 'group-blog'; } // Adds a class of hide-portfolio-page-content to blogs if Theme Option hide portfolio page content is ticked and page is using the Portfolio Template if (get_theme_mod('illustratr_hide_portfolio_page_content') && is_page_template('page-templates/portfolio-page.php')) { $classes[] = 'hide-portfolio-page-content'; } return $classes; }
function goodliving_child_custom_background() { // the fallback – our current active theme's default bg image $page_bg_image_url = get_background_image(); $repeat = get_theme_mod('background_repeat', 'repeat'); $position = get_theme_mod('background_position_x', 'left'); $attachment = get_theme_mod('background_attachment', 'scroll'); /* And below, spit out the <style> tag... */ echo '<style type="text/css" id="custom-background-css-override">'; echo 'header.hero-image { background-image: url(' . $page_bg_image_url . ') }'; echo 'header.hero-image { background-position: ' . $position . ' }'; echo 'header.hero-image { background-repeat: ' . $repeat . ' }'; // echo'header.hero-image { background-attachment: '.$attachment.' }'; echo 'header.hero-image { background-size: cover }'; echo '</style>'; }
function extra_custom_background_cb() { // $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_background_color(); if ($color === get_theme_support('custom-background', 'default-color')) { $color = false; } if (!$background && !$color) { return; } $style = $color ? "background-color: #{$color};" : ''; if ($background) { $image = " background-image: url('{$background}');"; $_repeat = get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat')); if (!in_array($_repeat, array('no-repeat', 'repeat-x', 'repeat-y', 'repeat'))) { $_repeat = 'repeat'; } $repeat = " background-repeat: {$_repeat};"; if ('no-repeat' == $_repeat) { $repeat .= " background-size: cover;"; } $position = get_theme_mod('background_position_x', get_theme_support('custom-background', 'default-position-x')); if (!in_array($position, array('center', 'right', 'left'))) { $position = 'left'; } $position = " background-position: top {$position};"; $attachment = get_theme_mod('background_attachment', get_theme_support('custom-background', 'default-attachment')); if (!in_array($attachment, array('fixed', 'scroll'))) { $attachment = 'scroll'; } $attachment = " background-attachment: {$attachment};"; $style .= $image . $repeat . $position . $attachment; } ?> <style type="text/css" id="extra-custom-background-css"> body.custom-background { <?php echo trim($style); ?> } </style> <?php }
/** * Adds custom classes to the array of body classes. * * @since Sundance 1.0 */ function sundance_body_classes($classes) { $options = sundance_get_theme_options(); $background_image = get_background_image(); // Adds a class of group-blog to blogs with more than 1 published author if (is_multi_author()) { $classes[] = 'group-blog'; } // Adds a class of no-sidebar when all syndicate links are disabled and no widgets if ('off' == $options['show_rss_link'] && '' == $options['twitter_url'] && '' == $options['facebook_url'] && '' == $options['google_url'] && '' == $options['flickr_url'] && !is_active_sidebar('sidebar-1')) { $classes[] = 'no-sidebar'; } // Add a class if background image is empty if (empty($background_image)) { $classes[] = 'custom-background-image-empty'; } return $classes; }
/** * 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; } $style = $color ? "background-color: #{$color};" : ''; if ($background) { $image = " background-image: url('{$background}');"; if ($background == $defaultoptions['background-header-image']) { $style .= $image; } else { $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', 'top'); if (!in_array($positiony, array('top', 'bottom'))) { $positiony = 'top'; } $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; } } echo '<style type="text/css" id="custom-background-css">'; echo '.header { ' . trim($style) . ' } '; echo '</style>'; }
function custom_background_image() { global $post; if (is_admin()) { return; } $page_bgimg_url = ''; $options = get_option('bgimg_settings'); // if front page only if ($options['bgimg_homepage']) { // then only set if the front pgage if (is_front_page() || is_home()) { $page_bgimg_url = get_background_image(); } } else { // make the global the default $page_bgimg_url = get_background_image(); // if single and single active if (is_singular() && $options['bgimg_single']) { // check to see if the theme supports Featured Images, and one is set if (current_theme_supports('post-thumbnails') && has_post_thumbnail($post->ID)) { // specify desired image size in place of 'full' $page_bgimg = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $page_bgimg_url = $page_bgimg[0]; // this returns just the URL of the image } } // get background image for a category if (is_archive() && $options['bgimg_category'] && function_exists('category_image_src')) { if (category_image_src() != '') { $page_bgimg_url = category_image_src(); } } } // write out css echo ' <style type="text/css" id="custom-background-css-override"> body.custom-background { ' . ($page_bgimg_url == '' ? 'background-image: none;' : 'background: url(' . $page_bgimg_url . ') no-repeat center center fixed;') . ($options['bgimg_fullscreen'] ? ' -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;' : '') . '} </style>'; }
/** * Adds custom classes to the array of body classes. * * @param array $classes Classes for the body element. * @return array */ function edin_body_classes($classes) { // Adds a class of group-blog to blogs with more than 1 published author. if (is_multi_author()) { $classes[] = 'group-blog'; } // Adds a class of has-custom-background to blogs with background settings different from default settings. if (get_background_image() || 'ffffff' != get_background_color()) { $classes[] = 'has-custom-background'; } // Adds a class of has-footer-navigation to blogs with footer navigation active. if (has_nav_menu('footer')) { $classes[] = 'has-footer-navigation'; } // Adds a class of has-header-search to blogs with search form in header. if (1 == get_theme_mod('edin_search_header')) { $classes[] = 'has-header-search'; } // Adds a class of navigation-(default|classic) to blogs. if ('classic' == get_theme_mod('edin_menu_style')) { $classes[] = 'navigation-classic'; } else { $classes[] = 'navigation-default'; } // Adds a class of no-header-navigation to blogs without a primary and a secondary menu. if (!has_nav_menu('primary') && !has_nav_menu('secondary')) { $classes[] = 'no-header-navigation'; } // Adds a class of no-sidebar-full, no-sidebar or sidebar-(right|left) to blogs. if (is_page_template('page-templates/front-page.php') || is_page_template('page-templates/grid-page.php') || is_page_template('page-templates/full-width-page.php') || is_404() || is_post_type_archive('jetpack-testimonial')) { $classes[] = 'no-sidebar-full'; } elseif (!is_active_sidebar('sidebar-1')) { $classes[] = 'no-sidebar'; } else { $classes[] = 'sidebar-' . get_theme_mod('edin_sidebar_position', 'right'); } // Adds a class of no-image-filter to blogs with the no filter theme option ticked. if (1 == get_theme_mod('edin_featured_image_remove_filter')) { $classes[] = 'no-image-filter'; } return $classes; }
function change_custom_background_cb() { $background = get_background_image(); $color = get_background_color(); if ( ! $background && ! $color ) 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; } ?> <style type="text/css" id="custom-background-css"> .custom-background { <?php echo trim($style); ?> } </style> <? }