Devstorm
Member
Posted 3 months ago #
Hi, is there some code/plugin which creates excerpts or more <more-tag>s (and auto-summaries) from Posts?
I have thousands of Posts to import from old CMS, so doing this manually is not possible. I think this is a fairly common task, so I hope there's already some plugin/hack available.
Joseph G.
Member
Posted 3 months ago #
You can do this by calling the_except() function. It must be called inside the wordpress loop.
If you want to automatically append a string such as "Read more..." for each excerpt you have called, it can be achieved by using add_filter function in wordpress.
Ex.
<?php
function addReadMoreToExcept(){
global $post;
$post_excerpt = get_the_excerpt( $post->ID );
$readMore_permalink = get_the_permalink( $post->ID );
$readMore_format = "[Read More...]";
$readMore = sprintf( "%s %s", $post_excerpt,$readMore_permalink, $readMore_format )
return $readMore;
}
add_action('the_except', 'addReadMoreToExcerpt');
/** Code not tested **/
?>
Something like that.
Thanks
Devstorm
Member
Posted 2 months ago #
Hi Joseph,
thank you for your answer. I implemented it this way now.
Best Wishes
Stefan