• Just wondering if there is a way to control the excerpt length from the loop instead of the functions for a twenty ten child theme.

    I have several layouts for a theme,which are changed by using a different loop file, and some of them would use a different excerpt length.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Couldn’t you do conditional’s based on the layout setting to assign the excerpt length?

    if ($layout == ‘2col-left’) $excerpt_length = 100; sort of thing?

    in the child themes functions.php, wrote this on the fly, not tested; but a maybe a good idea to steer towards.

    add_action('after_setup_theme', 'mychildtheme_after_theme_setup');
    
    mychildtheme_after_theme_setup() {
        remove_filter( 'excerpt_length', 'twentyten_excerpt_length' );
        add_filter('excerpt_length', 'mychildtheme_excerpt_length');
    }
    
    function mychildtheme_excerpt_length($length) {
       $options = get_option('myprivateoptions');
       if ($options['layout'] == 'somestyle') $length = 100;
       return $length;
    }
    Thread Starter zeaks

    (@zeaks)

    Thanks, I’ll give this a try

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Excerpt length in loop’ is closed to new replies.