leisegang
Member
Posted 3 years ago #
How do i add a "read more" link where the ... are ?
add_filter('the_content', 'content_intercept');
function content_intercept($content) {
//how many characters to show from each post
$maxchars = "200";
$newcontent = ''.substr($content, 0, $maxchars).'...';
return $newcontent;
}
I'm not quite sure what you are trying to acheive. Could you explain in more detail what you want this filter to do.
A read more link can be added using the following code
global $id;
$more_link_text='read more>>';
$newcontent .= ' <a href="'. get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>";
leisegang
Member
Posted 3 years ago #
can anyone help me with this. i couldnt find any plugin that did this. i searched a lot.
leisegang
Member
Posted 3 years ago #
tonymcclellan
Member
Posted 3 years ago #
In what php file do you add the global more? post-template?