questions

Replace excerpt ellipses with font awesome icon

Rate this post

In my post loop, I’m trying to replace the read more ellipses with a font awesome icon but it only works on the first post. The other posts just show the ellipses […].


the_excerpt();

// Post excerpt
function custom_excerpt_length($length) {
    return (is_front_page()) ? 15 : 25;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

// Changing excerpt more
function new_excerpt_more($more) {
    remove_filter('excerpt_more', 'new_excerpt_more');
    return ' <span class="read_more"><i class="fa fa-chevron-circle-right"></i></span>';
}
add_filter('excerpt_more', 'new_excerpt_more');

 

✔️Solution:

I don’t think you need this line:

remove_filter('excerpt_more', 'new_excerpt_more');

Leave a Reply

Your email address will not be published.

Back to top button