• mvitti185

    (@mvitti185)


    I am trying to customize the child theme’s functions.php file to expand the excerpt length of posts to 75 words rather than the default 55.

    Below is what I entered:

    <?php //Opening PHP tag
    // Custom Function to Include
    add_filter(‘excerpt_length’, ‘my_excerpt_length’);
    function my_excerpt_length($len) { return 75; }
    ?> //Closing PHP tag

    But it doesn’t work. What do I need to change?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Make sure there isn’t already a filter ‘excerpt_length’.
    If there is… remove it

    remove_filter( 'excerpt_length', 'twentyten_excerpt_length' );
    
    function my_twentyten_excerpt_length( $length ) {
    	return 50;
    }
    add_filter( 'excerpt_length', 'my_twentyten_excerpt_length' );
    Thread Starter mvitti185

    (@mvitti185)

    I tried that and now the whole of my blog has gone. I just get blank pages! I can’t get into my wordpress dashboard

    Thread Starter mvitti185

    (@mvitti185)

    I currently have this in my functions.customs.php file

    <?php
    function custom_excerpt_length( $length )
    	{
    	return 100;
    	}
    add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
    ?>

    However I want the excerpt to show only where I place ‘more’ and not beyond. Do I need to put in a an amount in return? I need this to be flexible for the various lengths I choose for each post.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Problem with excerpt length’ is closed to new replies.