Hello,
I’m trying to change the “read more” text underneath each excerpt of an article into something else. I tried doing it as described in this article:
I entered the exact same code in my child theme in the functions.php like this:
function x_child_theme_setup() {
// override parent theme's 'more' text for excerpts
remove_filter( 'excerpt_more', 'x_excerpt_string' );
remove_filter( 'the_content_more_link', 'x_content_string' );
}
add_action( 'after_setup_theme', 'x_child_theme_setup' );
function x_child_excerpt_string( $more ) {
$stack = x_get_stack();
if ( $stack == 'integrity' ) {
return '<div><a href="' . get_permalink() . '" class="x-btn">mehr...</a></div>';
} else if ( $stack == 'renew' ) {
return ' ... <a href="' . get_permalink() . '" class="x-btn">Read More</a>';
} else if ( $stack == 'icon' ) {
return ' ...';
}
}
add_filter( 'the_content_more_link', 'x_child_excerpt_string' );
Now the “read more” text gets removed, but it’s not being replaced with the new text I specified. The “x_child_excerpt_string” doesn’t even seem to execute. When I place an echo or even an exit in it, nothing happens. What am I doing wrong?