/**
  * Generate social links.
  *
  * @since 1.0.0
  */
 function blue_planet_generate_social_links()
 {
     $bp_options = blue_planet_get_option_all();
     $social_array = array();
     if (!empty($bp_options)) {
         foreach ($bp_options as $key => $val) {
             $pos = strpos($key, 'social_');
             if (false !== $pos && 0 === $pos && !empty($val)) {
                 $new_key = str_replace('social_', '', $key);
                 $social_array[$new_key] = $val;
             }
         }
     }
     if (!empty($social_array)) {
         echo '<div class="social-wrapper-outer">';
         echo '<div class="social-wrapper">';
         $link_target = apply_filters('blue_planet_filter_social_sites_link_target', '_blank');
         foreach ($social_array as $key => $site) {
             switch ($key) {
                 case 'email':
                     echo '<a class="social-email" href="mailto:' . esc_attr($site) . '"></a>';
                     break;
                 case 'skype':
                     echo '<a class="social-skype" href="skype:' . esc_attr($site) . '?call"></a>';
                     break;
                 default:
                     echo '<a class="social-' . esc_attr($key) . '" href="' . esc_url($site) . '" target="' . esc_attr($link_target) . '"></a>';
                     break;
             }
         }
         echo '</div><!-- .social-wrapper -->';
         echo '</div><!-- .social-wrapper-outer -->';
     }
 }
/**
 * Get theme option.
 *
 * @since 3.0.0
 *
 * @param string $key Option key.
 * @return mixed Option value.
 */
function blue_planet_get_option($key)
{
    $defaults = blue_planet_get_default_options();
    $options = blue_planet_get_option_all();
    $output = '';
    if (array_key_exists($key, $defaults)) {
        $output = $defaults[$key];
    }
    if (array_key_exists($key, $options)) {
        $output = $options[$key];
    }
    return $output;
}
Example #3
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function blue_planet_customize_register($wp_customize)
{
    $new_defaults = blue_planet_get_default_options();
    $options = blue_planet_get_option_all();
    // Custom Controls.
    require get_template_directory() . '/inc/customizer-includes/controls.php';
    $wp_customize->register_control_type('Blue_Planet_Customize_Heading_Control');
    $wp_customize->register_control_type('Blue_Planet_Customize_Dropdown_Taxonomies_Control');
    // Theme Settings.
    require get_template_directory() . '/inc/customizer-includes/theme.php';
    // Slider Settings.
    require get_template_directory() . '/inc/customizer-includes/slider.php';
    // Reset Settings.
    require get_template_directory() . '/inc/customizer-includes/reset.php';
}
Example #4
0
 /**
  * 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);
     }
 }
Example #5
0
/**
 * Get all theme options.
 *
 * @since 1.0.0
 * @deprecated 3.0
 *
 * @return array Theme options.
 */
function blueplanet_get_option_all()
{
    _deprecated_function('blueplanet_get_option_all', '3.0', 'blue_planet_get_option_all');
    return blue_planet_get_option_all();
}
Example #6
0
 /**
  * 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');
 }