Adding an excerpt to the related posts
-
I managed to adapt the plugin to show related posts with title, featured image and a truncated excerpt of the text.
There is a function in the plugin, MRP_truncate() you can use to cut off the content text.In the file microkids-related-posts.php (plugin folder) you need to adapt the code on line 639:
<script src=”http://pastebin.com/embed_js.php?i=jpvg8XsM”></script>This is the line that truncates the text to the size you want:
$output .= "<p>".MRP_truncate($related_post->post_content, $length = 120, $ending = '...', $exact = true, $considerHtml = true)."</p>";
I set it to 120 characters and $considerHtml = true, as I have html elements in my posts and pages.
On line 115 you can change the thumbnail size, if you have a custom thumbnail.
If you need more information on MRP_truncate (): it’s also in microkids-related-posts.php, near the bottom.
Anyone has a better solution than this one? I would be glad to hear it!
http://wordpress.org/extend/plugins/microkids-related-posts/
- The topic ‘Adding an excerpt to the related posts’ is closed to new replies.