' . __( 'Some themes provide customization options that are grouped together on a Theme Options screen. If you change themes, options may change or disappear, as they are theme-specific. Your current theme, Twenty Eleven, provides the following Theme Options:', 'twentyeleven' ) . '
' . '' . __( 'Remember to click "Save Changes" to save any changes you have made to the theme options.', 'twentyeleven' ) . '
' . '' . __( 'For more information:', 'twentyeleven' ) . '
' . '' . __( 'Documentation on Theme Options', 'twentyeleven' ) . '
' . '' . __( 'Support Forums', 'twentyeleven' ) . '
'; add_contextual_help( $theme_page, $help ); } add_action( 'admin_menu', 'twentyeleven_theme_options_add_page' ); /** * Returns an array of color schemes registered for Twenty Eleven. * * @since Twenty Eleven 1.0 */ function twentyeleven_color_schemes() { $color_scheme_options = array( 'light' => array( 'value' => 'light', 'label' => __( 'Light', 'twentyeleven' ), 'thumbnail' => get_template_directory_uri() . '/inc/images/light.png', 'default_link_color' => '#1b8be0', ), 'dark' => array( 'value' => 'dark', 'label' => __( 'Dark', 'twentyeleven' ), 'thumbnail' => get_template_directory_uri() . '/inc/images/dark.png', 'default_link_color' => '#e4741f', ), ); return apply_filters( 'twentyeleven_color_schemes', $color_scheme_options ); } /** * Returns an array of layout options registered for Twenty Eleven. * * @since Twenty Eleven 1.0 */ function twentyeleven_layouts() { $layout_options = array( 'content-sidebar' => array( 'value' => 'content-sidebar', 'label' => __( 'Content on left', 'twentyeleven' ), 'thumbnail' => get_template_directory_uri() . '/inc/images/content-sidebar.png', ), 'sidebar-content' => array( 'value' => 'sidebar-content', 'label' => __( 'Content on right', 'twentyeleven' ), 'thumbnail' => get_template_directory_uri() . '/inc/images/sidebar-content.png', ), 'content' => array( 'value' => 'content', 'label' => __( 'One-column, no sidebar', 'twentyeleven' ), 'thumbnail' => get_template_directory_uri() . '/inc/images/content.png', ), ); return apply_filters( 'twentyeleven_layouts', $layout_options ); } /** * Returns the default options for Twenty Eleven. * * @since Twenty Eleven 1.0 */ function twentyeleven_get_default_theme_options() { $default_theme_options = array( 'color_scheme' => 'light', 'link_color' => twentyeleven_get_default_link_color( 'light' ), 'theme_layout' => 'content-sidebar', ); if ( is_rtl() ) $default_theme_options['theme_layout'] = 'sidebar-content'; return apply_filters( 'twentyeleven_default_theme_options', $default_theme_options ); } /** * Returns the default link color for Twenty Eleven, based on color scheme. * * @since Twenty Eleven 1.0 * * @param $string $color_scheme Color scheme. Defaults to the active color scheme. * @return $string Color. */ function twentyeleven_get_default_link_color( $color_scheme = null ) { if ( null === $color_scheme ) { $options = twentyeleven_get_theme_options(); $color_scheme = $options['color_scheme']; } $color_schemes = twentyeleven_color_schemes(); if ( ! isset( $color_schemes[ $color_scheme ] ) ) return false; return $color_schemes[ $color_scheme ]['default_link_color']; } /** * Returns the options array for Twenty Eleven. * * @since Twenty Eleven 1.0 */ function twentyeleven_get_theme_options() { return get_option( 'twentyeleven_theme_options', twentyeleven_get_default_theme_options() ); } /** * Renders the Color Scheme setting field. * * @since Twenty Eleven 1.2 */ function twentyeleven_settings_field_color_scheme() { $options = twentyeleven_get_theme_options(); foreach ( twentyeleven_color_schemes() as $scheme ) { ?>