0

I want to be able to display various excerpt length, and different read more buttons that will say: "really? found out more" and "get more info" to different sections of the same page.

So far I found out from the wordpress codex that I can define excerpt length but I haven't been able to use it the right way :(

I defined custom excerpt length in my functions.php like this:

//Adds custom excerpt length
function custom_excerpt_length( $length ) {
    return 15;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

But when I add this to my desired section on the page the length of the excerpt affects to the whole page. This is my section's code:

<div class="col-md-6">
    <span class="dark-text"><?php the_excerpt('custom_excerpt_length'); ?></span>
</div>

How can I use that custom excerpt length just here and use one of my read more buttons from the beginning of my question?

Thanks guys!

Damir
  • 342
  • 9
  • 21

1 Answers1

0

you should check this below link which are create custom multiple excerpt lenght.

Multiple excerpt lengths in wordpress

It should work for you .

Community
  • 1
  • 1
kuldip Makadiya
  • 706
  • 4
  • 23
  • If you are not sure of your answer then please post it as a comment on the post itself. – Jordy Feb 18 '15 at 11:52