• How do I increase the length of the post excerpt that is displayed on the homepage? I have tried using the “More” button/code which has no affect.

    I’m guessing this must be specified in a php file. Please direct me to the correct file and function.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You need to add this to your functions.php in a child theme:

    function your_excerpt_length( $length ) {
        return 200;
    }
    add_filter( 'excerpt_length', 'your_excerpt_length' );

    Change 200 to what you need.

    Pls confirm this worked.

    Thread Starter geologist

    (@geologist)

    rdell consulting,

    I could not get this to work. I’ve been unable to get any code to work in my child theme functions.php file. So I’m assuming I’m making some basic mistake with the file. With your code, this is my entire functions.php file:

    <?php
    function your_excerpt_length( $length ) {
        return 400;
    }
    add_filter( 'excerpt_length', 'your_excerpt_length' ); 
    
    ?>

    When I upload this, my whole site blanks out.

    Any chance there’s a blank line after the ?>. I’ve seen that bring a site down before.

    Thread Starter geologist

    (@geologist)

    I’ve taken out everything that could possibly be read as a blank line and it still breaks the site. And yes, there was a blank line after the ?>.

    I realize this is bad programming, but can I safely put this function in the standard functions.php file somewhere?

    Not good practice, and you’ll lose it when you upgrade Customizr next time. Better to sort out why child theme not working.

    Your child theme should have 2 files – style.css and functions.php, assuming you’ve made no other changes. The header of the style.css should be as described here.

    customizr
    – files
    customizr-child
    – style.css
    -functions.php

    You need to activate the customizr-child theme in Appearance>Themes.

    Any change?

    Thread Starter geologist

    (@geologist)

    Thanks. My child css is working very well and the child theme has been activated for some time.

    shermansong

    (@shermansong)

    I tried this code, too, but I’m not getting any excerpts to show. Do I need anything else in the functions.php file?

    CivicConsultingUSA.org

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Change Length of Excerpt’ is closed to new replies.