array( 'value' => 'light', 'label' => __( 'Light', 'chateau' ), 'thumbnail' => get_template_directory_uri() . '/inc/images/light.png', 'default_link_color' => '#990000', ), 'dark' => array( 'value' => 'dark', 'label' => __( 'Dark', 'chateau' ), 'thumbnail' => get_template_directory_uri() . '/inc/images/dark.png', 'default_link_color' => '#ffffff', ), ); return apply_filters( 'chateau_color_schemes', $color_scheme_options ); } /** * Returns an array of archive styles registered for Chateau. * */ function chateau_archive_styles() { $archive_style_options = array( 'detail' => array( 'value' => 'detail', 'label' => __( 'Detail', 'chateau' ), 'thumbnail' => get_template_directory_uri() . '/inc/images/detail.png', ), 'concise' => array( 'value' => 'concise', 'label' => __( 'Concise', 'chateau' ), 'thumbnail' => get_template_directory_uri() . '/inc/images/concise.png', ), ); return apply_filters( 'chateau_archive_styles', $archive_style_options ); } /** * Returns an array of layouts registered for Chateau. * */ function chateau_theme_layouts() { $theme_layout_options = array( 'sidebar-content' => array( 'value' => 'sidebar-content', 'label' => __( 'Sidebar-Content', 'chateau' ), 'thumbnail' => get_template_directory_uri() . '/inc/images/sidebar-content.png', ), 'content-sidebar' => array( 'value' => 'content-sidebar', 'label' => __( 'Content-Sidebar', 'chateau' ), 'thumbnail' => get_template_directory_uri() . '/inc/images/content-sidebar.png', ), 'content' => array( 'value' => 'content', 'label' => __( 'One Column, No Sidebar', 'chateau' ), 'thumbnail' => get_template_directory_uri() . '/inc/images/content.png', ) ); return apply_filters( 'chateau_theme_layouts', $theme_layout_options ); } /** * Returns the default options for Chateau. * */ function chateau_get_default_theme_options() { $default_theme_options = array( 'color_scheme' => 'light', 'link_color' => chateau_get_default_link_color( 'light' ), 'archive_style' => 'detail', 'theme_layout' => 'sidebar-content' ); return apply_filters( 'chateau_default_theme_options', $default_theme_options ); } /** * Returns the default link color for Chateau, based on color scheme. * * @param $string $color_scheme Color scheme. Defaults to the active color scheme. * @return $string Color. */ function chateau_get_default_link_color( $color_scheme = null ) { if ( null === $color_scheme ) { $options = chateau_get_theme_options(); $color_scheme = $options['color_scheme']; } $color_schemes = chateau_color_schemes(); if ( ! isset( $color_schemes[ $color_scheme ] ) ) return false; return $color_schemes[ $color_scheme ]['default_link_color']; } /** * Returns the options array for Chateau. * */ function chateau_get_theme_options() { return get_option( 'chateau_theme_options', chateau_get_default_theme_options() ); } /** * Returns the options array for Chateau. * */ function theme_options_render_page() { ?>


' . chateau_get_default_link_color( $options['color_scheme'] ) . '' ); ?>

'reset' ) ); ?>

$value ) { if ( isset( $defaults[$field] ) ) $output[$field] = $defaults[$field]; else unset( $output[$field] ); } } return apply_filters( 'chateau_theme_options_validate', $output, $input, $defaults ); } /** * Enqueue the styles for the current color scheme. * */ function chateau_enqueue_color_scheme() { $options = chateau_get_theme_options(); $color_scheme = $options['color_scheme']; if ( 'dark' == $color_scheme ) wp_enqueue_style( 'dark', get_template_directory_uri() . '/css/dark.css', array(), null ); do_action( 'chateau_enqueue_color_scheme', $color_scheme ); } add_action( 'wp_enqueue_scripts', 'chateau_enqueue_color_scheme' ); /** * Add a style block to the theme for the current link color. * * This function is attached to the wp_head action hook. * */ function chateau_print_link_color_style() { $options = chateau_get_theme_options(); $link_color = $options['link_color']; $default_options = chateau_get_default_theme_options(); // Don't do anything if the current link color is the default. if ( $default_options['link_color'] == $link_color ) return; ?>