• Can the … in an excerpt be made clickable? As in, I’d like the … in the […] at the end of an excerpt to link to that post’s permalink. I looked in the codex but didn’t see any description of how to alter the actual excerpt. I’m also assuming I missed something there as well.

    If someone could either point me to the right article or assist here, that’d be super. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Adding the following code to the functions.php of your theme should do the trick:

    function clickable_ellipsis($content){
    
    	$searchfor = '/\[(…)\]/';
    	$replacewith = '[<a href="'.get_permalink().'">$1</a>]';
    
    	$content = preg_replace($searchfor, $replacewith, $content);
    	return $content;
    
    }
    
    add_filter('the_excerpt', 'clickable_ellipsis');
    Thread Starter essdub

    (@essdub)

    Hmm. No dice. I plugged in your code just above another function (and made sure we have three periods in there and not that funky character that shows up in your code) but my … are still just … and not clickable. You can see it at the bottom of this page: https://epicmcc.org

    yay… the funky character you mention is supposed to be an ellipsis character which is different from three points “& # 8 2 3 0 ;” without the spaces… I’m unable to paste it here without it converting to the actual ellipsis…

    Like this:

    https://wpguy.com/files/code.txt

    Maybe it’ll be easier to use 4k’s suggested plugin… your call ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Make … in […] clickable’ is closed to new replies.