• I’ve added a few extra color schemes and layouts to Twenty Eleven in a child theme. I want to set a color scheme and layout as default when the child theme is activated.
    This is what I’m using

    // Set default color scheme and layout
    add_filter( 'twentyeleven_default_theme_options', 'my_default_options' );
    function my_default_options( $options ) {
        $options['color_scheme'] = 'orange';
        $options['layouts'] = 'narrow-content-left-sidebar';
        return $options;
    }

    But it doesn’t seem to work. Anyone have any idea what’s wrong with it? I can supply more info on the theme options I’m using if needed.

    Thanks for any help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Did you figure this out Scott? I’m using NomNom theme and want it to default to one of the non-Twenty Eleven schemes.

    Have a look in the twenty eleven /inc/theme-options.php

    There is a function there ‘twentyeleven_get_default_theme_options()’

    It is not pluggable, so create a function in the child theme, run an action after_setup_theme.

    This is UNTESTED:

    add_action( 'after_setup_theme', 'child_get_default_theme_options' );
    function child_get_default_theme_options() {
    	$default_theme_options = array(
    		'color_scheme' => 'orange',
    		'link_color'   => twentyeleven_get_default_link_color( 'light' ),
    		'theme_layout' => 'narrow-content-left-sidebar',
    	);
    
    	if ( is_rtl() )
     		$default_theme_options['theme_layout'] = 'sidebar-content';
    
    	return apply_filters( 'twentyeleven_default_theme_options', $default_theme_options );
    }

    HTH

    David

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Set default color scheme & layout 2011’ is closed to new replies.