- Timestamp:
- 06/08/2011 05:39:12 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentyeleven/inc/theme-options.php
r18181 r18198 119 119 'label' => __( 'Light', 'twentyeleven' ), 120 120 'thumbnail' => get_template_directory_uri() . '/inc/images/light.png', 121 'default_link_color' => '#1b8be0', 121 122 ), 122 123 'dark' => array( … … 124 125 'label' => __( 'Dark', 'twentyeleven' ), 125 126 'thumbnail' => get_template_directory_uri() . '/inc/images/dark.png', 127 'default_link_color' => '#e4741f', 126 128 ), 127 129 ); … … 165 167 $default_theme_options = array( 166 168 'color_scheme' => 'light', 167 'link_color' => '#1b8be0',169 'link_color' => twentyeleven_get_default_link_color( 'light' ), 168 170 'theme_layout' => 'content-sidebar', 169 171 ); 170 172 171 173 return apply_filters( 'twentyeleven_default_theme_options', $default_theme_options ); 174 } 175 176 /** 177 * Returns the default link color for Twenty Eleven, based on color scheme. 178 * 179 * @since Twenty Eleven 1.0 180 * 181 * @param $string $color_scheme Color scheme. Defaults to the active color scheme. 182 * @return $string Color. 183 */ 184 function twentyeleven_get_default_link_color( $color_scheme = null ) { 185 if ( null === $color_scheme ) { 186 $options = twentyeleven_get_theme_options(); 187 $color_scheme = $options['color_scheme']; 188 } 189 190 $color_schemes = twentyeleven_color_schemes(); 191 if ( ! isset( $color_schemes[ $color_scheme ] ) ) 192 return false; 193 194 return $color_schemes[ $color_scheme ]['default_link_color']; 172 195 } 173 196 … … 206 229 <fieldset><legend class="screen-reader-text"><span><?php _e( 'Color Scheme', 'twentyeleven' ); ?></span></legend> 207 230 <?php 208 foreach ( twentyeleven_color_schemes() as $ color) {231 foreach ( twentyeleven_color_schemes() as $scheme ) { 209 232 ?> 210 233 <div class="layout"> 211 234 <label class="description"> 212 <input type="radio" name="twentyeleven_theme_options[color_scheme]" value="<?php echo esc_attr( $color['value'] ); ?>" <?php checked( $options['color_scheme'], $color['value'] ); ?> /> 235 <input type="radio" name="twentyeleven_theme_options[color_scheme]" value="<?php echo esc_attr( $scheme['value'] ); ?>" <?php checked( $options['color_scheme'], $scheme['value'] ); ?> /> 236 <input type="hidden" id="default-color-<?php echo esc_attr( $scheme['value'] ); ?>" value="<?php echo esc_attr( $scheme['default_link_color'] ); ?>" /> 213 237 <span> 214 <img src="<?php echo esc_url( $ color['thumbnail'] ); ?>" alt=""/>215 <?php echo $ color['label']; ?>238 <img src="<?php echo esc_url( $scheme['thumbnail'] ); ?>" width="136" height="122" alt="" /> 239 <?php echo $scheme['label']; ?> 216 240 </span> 217 241 </label> … … 232 256 <div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div> 233 257 <br /> 234 <s mall class="description"><?php printf( __( 'Default color: %s', 'twentyeleven' ), $default_options['link_color'] ); ?></small>258 <span><?php printf( __( 'Default color: %s', 'twentyeleven' ), '<span id="default-color">' . twentyeleven_get_default_link_color( $options['color_scheme'] ) . '</span>' ); ?></span> 235 259 </fieldset> 236 260 </td> … … 247 271 <input type="radio" name="twentyeleven_theme_options[theme_layout]" value="<?php echo esc_attr( $layout['value'] ); ?>" <?php checked( $options['theme_layout'], $layout['value'] ); ?> /> 248 272 <span> 249 <img src="<?php echo esc_url( $layout['thumbnail'] ); ?>" alt=""/>273 <img src="<?php echo esc_url( $layout['thumbnail'] ); ?>" width="136" height="122" alt="" /> 250 274 <?php echo $layout['label']; ?> 251 275 </span> … … 280 304 if ( isset( $input['color_scheme'] ) && array_key_exists( $input['color_scheme'], twentyeleven_color_schemes() ) ) 281 305 $output['color_scheme'] = $input['color_scheme']; 306 307 // Our defaults for the link color may have changed, based on the color scheme. 308 $output['link_color'] = $defaults['link_color'] = twentyeleven_get_default_link_color( $output['color_scheme'] ); 282 309 283 310 // Link color must be 3 or 6 hexadecimal characters
Note: See TracChangeset
for help on using the changeset viewer.