Ready to get started?Download WordPress


Changing excerpt length in child theme (9 posts)

  1. lynnema
    Posted 1 year ago #

    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!

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    Check your site's error logs for clues.

  3. lynnema
    Posted 1 year ago #

    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!

  4. lynnema
    Posted 1 year ago #

    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?

  5. esmi
    Forum Moderator
    Posted 1 year ago #

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

  6. lynnema
    Posted 1 year ago #

    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 :-)

  7. esmi
    Forum Moderator
    Posted 1 year ago #

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

  8. lynnema
    Posted 1 year ago #

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

  9. esmi
    Forum Moderator
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.