Hello @bretweb,
Please do the following here to add a read more link to excerpt content of section News.
https://developer.wordpress.org/reference/functions/the_excerpt/#comment-327
Hope it helps!
Hello
thank you for your link but I’m not really good in PHP ; I have tried some edit but not a result or error ! 🙁
PLease can you take two second to give me something working ?
Thanks a lot 🙂
Hi @bretweb,
I just check your site and see you’ve added it already:
https://cl.ly/1131acee4b1a
Let me know!
Yes
finally I have find something workink … but this script hide completely the text excerpt and not add a link at the read-more
can you give me something a better solution ?
// Replaces the excerpt “Read More” text by a link
function new_excerpt_more($more) {
global $post;
return ‘ID) . ‘”> …‘;
}
add_filter(‘the_excerpt’, ‘new_excerpt_more’);
Thank you
Hey @bretweb,
It seems you did wrong. You must add the filter for excerpt_more instead of the_excerpt. Please read again here:
https://developer.wordpress.org/reference/functions/the_excerpt/#comment-327
thanks for your info
But I have tried to remplace the_excerpt by excerpt_more into the script … it’s same, link ok but no entry text ….
// Replaces the excerpt "Read More" text by a link
function new_excerpt_more($more) {
global $post;
return '<a class="moretag" href="'. get_permalink($post->ID) . '"> ...</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
excuse me doesnt’ works
I also tried this one … result is just a link no entry text
/**
* Filter the "read more" excerpt string link to the post.
*
* @param string $more "Read more" excerpt string.
* @return string (Maybe) modified "read more" excerpt string.
*/
function wpdocs_excerpt_more( $more ) {
if ( ! is_single() ) {
$more = sprintf( '<a class="read-more" href="%1$s">%2$s</a>',
get_permalink( get_the_ID() ),
__( '...', 'textdomain' )
);
}
return $more;
}
add_filter( 'the_excerpt', 'wpdocs_excerpt_more' );
@bretweb
Please submit your issue here then our tech support will help:
https://www.famethemes.com/contact/
Kind regards.
Hi @bretweb,
Please mark the topic is resolved and help us write a review here 🙂
https://wordpress.org/support/theme/onepress/reviews/
Thank you!
-
This reply was modified 5 years, 10 months ago by FameThemes.