Custom Excerpt Length not working
-
I have:
<?php the_excerpt(); ?>
on my custom home page. By default it’s set to the 55 words. So I tried using the expert_length filter and it doesn’t seem to be changing the length.
I also wanted to add a “Read More” link and that isn’t working also. Here’s the code I have in my functions.php folder:
<?php function custom_excerpt_length( $length ) { return 35; //Change this number to any integer you like. } add_filter( 'excerpt_length', 'custom_excerpt_length', 999); function new_excerpt_more( $more ) { return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">Read More</a>'; } add_filter( 'excerpt_more', 'new_excerpt_more' ); ?>
Are there other reasons why this might not be working? Google and the codex haven’t turned up any fixes.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Custom Excerpt Length not working’ is closed to new replies.