-
Notifications
You must be signed in to change notification settings - Fork 11
Related Posts
Ben Gillbanks edited this page Aug 20, 2019
·
11 revisions
Toolbelt can automatically append related posts to the end of post content.
The related posts will be selected randomly from posts in the same categories as the post being viewed. A collection of posts are saved in a transient (specific to the current post), and then 2 posts are selected and appended to the end of the post content.
Related posts with images are given priority, since they look nicer :)
Change how many related posts are displayed.
By default 2 posts are displayed.
function my_toolbelt_related_posts_count() {
return 4;
}
add_filter( 'toolbelt_related_posts_count', 'my_toolbelt_related_posts_count' );
The thumbnail size to use for the featured images. By default the medium image size is used.
function my_toolbelt_related_posts_thumbnail_size() {
return 'some-image-size-handle';
}
add_filter( 'toolbelt_related_posts_thumbnail_size', 'my_toolbelt_related_posts_thumbnail_size' );
Toolbelt is built by Ben from Pro Theme Design.