add_setting( 'highwind_theme_options[theme_layout]', array( 'type' => 'option', 'default' => apply_filters( 'highwind_layout_default', 'sidebar-content' ), 'sanitize_callback' => 'sanitize_key', ) ); // Link Color Default $wp_customize->add_setting( 'link_textcolor', array( 'default' => apply_filters( 'highwind_link_textcolor_default', $color = '53a1b8' ) ) ); // Heading Color Default $wp_customize->add_setting( 'headercolor', array( 'default' => apply_filters( 'highwind_headercolor_default', $color = '444854' ) ) ); // Text Color Default $wp_customize->add_setting( 'textcolor', array( 'default' => apply_filters( 'highwind_textcolor_default', $color = '666A76' ) ) ); // Background Color Default $wp_customize->add_setting( 'background_color', array( 'default' => apply_filters( 'highwind_background_color_default', $color = 'f8f8f9' ) ) ); /** * Theme Option Sections */ // Navigation Section $wp_customize->add_section( 'nav', array( 'title' => __( 'Navigation', 'highwind' ), 'theme_supports' => 'menus', 'priority' => 100, ) ); // Layout Section $wp_customize->add_section( 'highwind_layout', array( 'title' => __( 'Layout', 'highwind' ), 'priority' => 50, ) ); /** * Theme Option Controls */ // Link Color Control $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_textcolor', array( 'label' => __( 'Link Color', 'highwind' ), 'section' => 'colors', 'settings' => 'link_textcolor', ) ) ); // Heading Color Control $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'headercolor', array( 'label' => __( 'Header Color', 'highwind' ), 'section' => 'colors', 'settings' => 'headercolor', ) ) ); // Text Color Control $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'textcolor', array( 'label' => __( 'Text Color', 'highwind' ), 'section' => 'colors', 'settings' => 'textcolor', ) ) ); // Background Color Control $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'background_color', array( 'label' => __( 'Background Color', 'highwind' ), 'section' => 'colors', 'settings' => 'background_color', ) ) ); // Layout Control $layouts = highwind_layouts(); $choices = array(); foreach ( $layouts as $layout ) { $choices[$layout['value']] = $layout['label']; } $wp_customize->add_control( 'highwind_theme_options[theme_layout]', array( 'section' => 'highwind_layout', 'type' => 'radio', 'choices' => $choices, ) ); } /** * This will output the custom WordPress settings to the theme's WP head. * * Used by hook: 'wp_head' * * @see add_action('wp_head',$func) */ public static function highwind_render() { ?> apply_filters( 'highwind_background_color_default', $color = 'f8f8f9' ) ); add_theme_support( 'custom-background', $args ); } /** * Returns the options array for Highwind. * * @since 1.0 */ function highwind_get_theme_options() { return get_option( 'highwind_theme_options', highwind_get_default_theme_options() ); } /** * Returns the default options for Highwind layout. * * @since 1.0 */ function highwind_get_default_theme_options() { $default_theme_options = array( 'theme_layout' => apply_filters( 'highwind_layout_default', $layout = 'content-sidebar' ), ); if ( is_rtl() ) $default_theme_options['theme_layout'] = apply_filters( 'highwind_layout_default', 'sidebar-content' ); return apply_filters( 'highwind_default_theme_options', $default_theme_options ); } /** * Returns an array of layout options registered for Highwind. * * @since 1.0 */ function highwind_layouts() { $layout_options = array( 'content-sidebar' => array( 'value' => 'content-sidebar', 'label' => __( 'Content on left', 'highwind' ), ), 'sidebar-content' => array( 'value' => 'sidebar-content', 'label' => __( 'Content on right', 'highwind' ), ), ); return apply_filters( 'highwind_layouts', $layout_options ); } /** * Adds Highwind layout classes to the array of body classes. * * @since 1.0 */ function highwind_layout_classes( $existing_classes ) { $options = highwind_get_theme_options(); $current_layout = $options['theme_layout']; if ( in_array( $current_layout, array( 'content-sidebar', 'sidebar-content' ) ) ) $classes = array( 'two-column' ); else $classes = array( 'one-column' ); if ( 'content-sidebar' == $current_layout ) $classes[] = 'content-sidebar'; elseif ( 'sidebar-content' == $current_layout ) $classes[] = 'sidebar-content'; else $classes[] = $current_layout; $classes = apply_filters( 'highwind_layout_classes', $classes, $current_layout ); return array_merge( $existing_classes, $classes ); }