Support » How-To and Troubleshooting » Changing excerpt length in child theme

Changing excerpt length in child theme

  • Hi everyone – I’ve been researching this and testing and the like, and I can’t seem to get this to work. Here is my code:

    /* Set up actions */
    add_action( 'after_setup_theme', 'twentyeleven-child_setup' );
    if ( ! function_exists( 'isr_setup' ) ):
    function isr_setup() {
        function isr_clientname_excerpt_length( $length ) {
            return 20;
        remove_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );
        add_filter( 'excerpt_length', 'isr_clientname_excerpt_length' );
    endif; // isr_setup

    My child theme is named twentyeleven-child.

    I’m getting a server error with the blank screen showing.

    I’m sure this is user error – I just can’t figure it out.

    Thanks in advance!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Check your site’s error logs for clues.

    Thanks esmi – turns out I’m a dork. I was uploading the wrong file.

    So, now that the correct file is place (rolling eyes at myself here…), I’m not seeing any change in the number of words – looksl ike it is still defaulting to the twentyeleven theme default of 40 instead of the 20 I requested. Would this also be in the error log, or is there something else I can do?

    Thanks again!

    I checked the error log, and I’m getting this error:

    PHP Warning:  call_user_func_array() [<a href='function.call-user-func-array'>function.call-user-func-array</a>]: First argument is expected to be a valid callback, 'twentyeleven-child_setup' was given in /home3/indusuf6/public_html/wp-includes/plugin.php on line 406

    Not sure why this owuld be impacting my ability to reduce excerpt length. Any thoughts?

    Have you edited the default WordPress theme (Twenty Twelve) at all?

    Nope – I’m using twentyeleven and a child theme. I’m not the best at WP, but I know all about the child theme requirements 🙂

    Sorry – my mistake. It looks like there’s an error in your child theme’s setup function.

    Where should I start to look to troubleshoot? Any thoughts? This is the last tiny piece I need to get things in place 🙂

    It’s not possible to tell exactly here the problem is from the error massage. All I can suggest is that you check the twentyeleven-child_setup() function.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Changing excerpt length in child theme’ is closed to new replies.