Community Forums › Forums › Archived Forums › Design Tips and Tricks › how modify ‘read more’ on post excerpt
- This topic has 2 replies, 3 voices, and was last updated 6 years, 7 months ago by Susan.
-
AuthorPosts
-
August 30, 2017 at 6:54 am #210886p297Member
Hi,
I'm trying to edit the read more code that shows on a post excerpt to remove the ellipsis. It currently says '... [Read more...]' with the '[Read more...] a hyperlink (see included URL). I want it to just say '[Read more...]'.
I've tried 6 different variations of code that I've found on help docs and forums in the functions.php file but haven't gotten the results I wanted. 5 variations made no change and 1 broke the code.
1. No change
/** * Override the default string for automatic excerpts * * @param type $more * @return string */ function custom_excerpt_more($more) { return '';// return empty string } add_filter('excerpt_more', 'custom_excerpt_more');
2. No change
// Add Read More Link to Excerpts add_filter('excerpt_more', 'get_read_more_link'); add_filter( 'the_content_more_link', 'get_read_more_link' ); function get_read_more_link() { return '... <a href="' . get_permalink() . '">[Read More]</a>'; }
3. No change
function replace_excerpt($content) { return str_replace('[...]', '<div class="more-link"><a href="'. get_permalink() .'">Continue Reading</a></div>', $content ); } add_filter('the_excerpt', 'replace_excerpt');
4. Broke the code - code same as in 3 with an addition to it suggested in the forum
function replace_excerpt($content) { return str_replace('[...]', '<div class="more-link"><a href="'. get_permalink() .'">Continue Reading</a></div>', $content ); } add_filter('the_excerpt', 'replace_excerpt'); <?php function replace_excerpt($content) { return str_replace('[…]', '... ', $content ); }?>
5. No change
// Changing excerpt more function new_excerpt_more($more) { global $post; remove_filter('excerpt_more', 'new_excerpt_more'); return ' <a>ID) . '">' . 'read more' . '</a>'; } add_filter('excerpt_more','new_excerpt_more'); add_filter('excerpt_more','__return_false');
6. No change - code snippet from last line in 5 after forum said 'if you just want to strip the ellipsis'
add_filter('excerpt_more','__return_false');
7. No change
function trim_excerpt($text) { return rtrim($text,'[...]'); } add_filter('get_the_excerpt', 'trim_excerpt');
I've also tried looking in the archive.php, front-page.php, page_archive.php, single.php, functions.php, and even the styles.css files to try and find the code where I can customize the read more to remove the ellipsis - ... - but haven't found anything.
Please help!
https://www.mexicaliblues.com/ourstories/2017/08/August 30, 2017 at 7:08 am #210918Victor FontModeratorYou are using a very old XHTML theme from http://www.ebusinesscoach.com/. This is a community marketplace theme, not a Studio Press theme. Chances are good that the read more was already modified by the theme developer which is why the snippets aren't working. The theme is not available in the download archives and without looking through the code, as community volunteers, I don't think we can help you. You can either try contacting the developer for assistance or hiring someone to look through your code.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?August 31, 2017 at 5:52 pm #211002SusanModeratorI'm closing this thread, as it's a duplicate of this one:
-
AuthorPosts
- The topic ‘how modify ‘read more’ on post excerpt’ is closed to new replies.