in this page /
Last post is with excerpt.
If my posts don´t have excerpt show read more If I add excerpt the button doesn´t show.
In functions.php
// Replaces the excerpt "Read More" text by a link
function clean_blogging_excerpt_more($more) {
if ( is_admin() ) {
return $more;
}
global $post;
return '<p><a class="readmore" href="'. get_permalink($post->ID) . '">Leer Más</a></p>';
}
add_filter('excerpt_more', 'clean_blogging_excerpt_more');
in this page https://blog.despierta/page/3/
Last post is with excerpt.
If my posts don´t have excerpt show read more If I add excerpt the button doesn´t show.
In functions.php
// Replaces the excerpt "Read More" text by a link
function clean_blogging_excerpt_more($more) {
if ( is_admin() ) {
return $more;
}
global $post;
return '<p><a class="readmore" href="'. get_permalink($post->ID) . '">Leer Más</a></p>';
}
add_filter('excerpt_more', 'clean_blogging_excerpt_more');
You are using the wrong filter. Depending on how your theme is built, there may be two solutions.
If the theme uses the wp_trim_excerpt
function, the
excerpt_more
filter inside that function will only be called if
there is no excerpt passed to that function. At the end of that
function there still is the wp_trim_excerpt
filter that you could
use to append anything to the result.
If the theme uses the get_the_excerpt
function to echo
the excerpt there is a filter with the same name that you may use.
Both solutions may work at the same time, so don't overdo it.