Archived topic
Change the Read More to custom text
1 reply · Started by Kelvin on September 5, 2022
Dear Sir/Madam,
I have a Query-loop at the home page, I want to change the Read More to custom text, I refer to this article https://generatepress.com/forums/topic/customizing-the-read-more-text-on-all-archive-pages/, below is the code I added to functions.php but none of them work. Could you please advise which filter I should change?
function modify_read_more_link() {
return '<a class="more-link" href="' . get_permalink() . '">Continue ...</a>';
}
add_filter( 'the_content_more_link', 'modify_read_more_link' );
function new_excerpt_more($more) {
global $post;
return '<a class="moretag"
href="'. get_permalink($post->ID) . '">Continue ...</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
function excerpt_read_more_link($output) {
global $post;
$text = 'Continue ...';
return $output . '<a class="more-link" href="'. get_permalink($post->ID) . '">'. $text .'</a>';
}
add_filter('the_excerpt', 'excerpt_read_more_link');
Hi there,
they won't work with a Query Loop block.
Instead, select your Excerpt in the Query Loop and disable the default read more option.
And then add a GB Button, and make that your read more by 1) adding your button label 2) add the Dynamic Link to the Single Post.