/** * Return default layout class. * * @since 1.0.0 * * @return string Class. */ function blue_planet_layout_setup_class() { $default_layout = blue_planet_get_option('default_layout'); if ('right-sidebar' === $default_layout) { $class = ' pull-left '; } else { $class = ' pull-right '; } return $class; }
/** * Import Custom CSS. * * @since 3.5.0 */ function blue_planet_import_custom_css() { // Bail if not WP 4.7. if (!function_exists('wp_get_custom_css_post')) { return; } $custom_css = blue_planet_get_option('custom_css'); // Bail if there is no Custom CSS. if (empty($custom_css)) { return; } $core_css = wp_get_custom_css(); $return = wp_update_custom_css_post($core_css . $custom_css); if (!is_wp_error($return)) { // Remove from theme. $options = blue_planet_get_option_all(); $options['custom_css'] = ''; set_theme_mod('blueplanet_options', $options); } }
/** * Get theme option. * * @since 1.0.0 * @deprecated 3.0 * * @param string $key Option key. * @return mixed Option value. */ function blueplanet_get_option($key) { _deprecated_function('blueplanet_get_option', '3.0', 'blue_planet_get_option'); return blue_planet_get_option($key); }
/** * Enqueue scripts and styles. */ function blue_planet_scripts() { $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_enqueue_style('blue-planet-style-bootstrap', get_template_directory_uri() . '/thirdparty/bootstrap/css/bootstrap' . $min . '.css', false, '3.3.6'); wp_enqueue_style('genericons', get_template_directory_uri() . '/thirdparty/genericons/genericons' . $min . '.css', array(), '3.4.1'); wp_enqueue_style('meanmenu-style', get_template_directory_uri() . '/thirdparty/meanmenu/meanmenu' . $min . '.css', false, '2.0.6'); wp_enqueue_style('blue-planet-style', get_stylesheet_uri(), array(), '3.6'); $banner_background_color = blue_planet_get_option('banner_background_color'); $custom_css = blue_planet_get_option('custom_css'); $custom_style = "header#masthead{background-color:" . esc_attr($banner_background_color) . ";}"; if (!empty($custom_css)) { $custom_style .= $custom_css; } wp_add_inline_style('blue-planet-style', $custom_style); wp_enqueue_script('blue-planet-navigation', get_template_directory_uri() . '/js/navigation' . $min . '.js', array(), '20120206', true); wp_enqueue_script('blue-planet-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix' . $min . '.js', array(), '20130115', true); if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } $slider_status = blue_planet_get_option('slider_status'); $slider_status_2 = blue_planet_get_option('slider_status_2'); if ('none' !== $slider_status || 'none' !== $slider_status_2) { wp_enqueue_style('nivo-slider-style', get_template_directory_uri() . '/thirdparty/nivoslider/nivo-slider' . $min . '.css', false, '3.2'); wp_enqueue_style('nivo-slider-style-theme', get_template_directory_uri() . '/thirdparty/nivoslider/themes/default/default' . $min . '.css', false, '3.2'); wp_enqueue_script('nivo-slider-script', get_template_directory_uri() . '/thirdparty/nivoslider/jquery.nivo.slider' . $min . '.js', array('jquery'), '3.2', true); wp_register_script('blue-planet-theme-script-slider', get_template_directory_uri() . '/js/slider' . $min . '.js', array('jquery', 'nivo-slider-script'), '2.0.0', true); $options = blue_planet_get_option_all(); wp_localize_script('blue-planet-theme-script-slider', 'BP_OPTIONS', $options); wp_enqueue_script('blue-planet-theme-script-slider'); } wp_enqueue_script('meanmenu-script', get_template_directory_uri() . '/thirdparty/meanmenu/jquery.meanmenu' . $min . '.js', array('jquery'), '2.0.6', true); wp_enqueue_script('blue-planet-theme-script-custom', get_template_directory_uri() . '/js/custom' . $min . '.js', array('jquery'), '2.0.0', true); // Scripts for IE hack. wp_enqueue_script('blue-planet-html5shiv', get_template_directory_uri() . '/js/html5shiv' . $min . '.js', array(), '3.7.3', false); wp_script_add_data('blue-planet-html5shiv', 'conditional', 'lt IE 9'); wp_enqueue_script('blue-planet-respond', get_template_directory_uri() . '/js/respond' . $min . '.js', array(), '1.4.2', false); wp_script_add_data('blue-planet-respond', 'conditional', 'lt IE 9'); }
<?php /** * The template for displaying search forms in Blue Planet * * @package Blue_Planet */ $search_placeholder = blue_planet_get_option('search_placeholder'); ?> <form role="search" method="get" class="search-form" action="<?php echo esc_url(home_url('/')); ?> "> <fieldset> <span class="screen-reader-text"><?php echo esc_html_x('Search for:', 'label', 'blue-planet'); ?> </span> <input type="search" class="search-field" placeholder="<?php echo esc_attr($search_placeholder); ?> " value="<?php echo get_search_query(); ?> " name="s" title="<?php echo esc_attr_x('Search for:', 'label', 'blue-planet'); ?> "> <input type="submit" class="search-submit" value="<?php echo esc_attr_x('Search', 'submit button', 'blue-planet'); ?>
if ('post' === get_post_type()) { ?> <div class="entry-meta"> <?php blue_planet_posted_on(); ?> </div><!-- .entry-meta --> <?php } ?> </header><!-- .entry-header --> <?php $content_layout = blue_planet_get_option('content_layout'); $archive_image = blue_planet_get_option('archive_image'); $archive_image_alignment = blue_planet_get_option('archive_image_alignment'); ?> <div class="entry-content"> <?php if (has_post_thumbnail() && 'disable' !== $archive_image) { ?> <a href="<?php the_permalink(); ?> "> <?php the_post_thumbnail(esc_attr($archive_image), array('class' => esc_attr('align' . $archive_image_alignment))); ?> </a> <?php
/** * Callback for reset in Customizer. * * @since 3.4.0 */ function blue_planet_customizer_reset_callback() { $reset_theme_settings = blue_planet_get_option('reset_theme_settings'); if (1 == $reset_theme_settings) { // Reset custom theme options. set_theme_mod('blueplanet_options', array()); // Reset custom header and backgrounds. remove_theme_mod('header_image'); remove_theme_mod('header_image_data'); remove_theme_mod('background_image'); remove_theme_mod('background_color'); } }