I set up the plugin to show 10 related posts in the options panel but I don’t want to show 10 posts everywhere; just in some places.
Is there a way to tweak <?php related_posts(); ?> to show a different number of posts aside from what I set in the options panel?
Try adding limit option in the
$argsarray of therelated_posts()function.Update 1:
You also need to figure out how will the number of limit be determined. You could have a default number that is then overriden if some custom field exists with a value, something like:
So in above code, the default limit is 5. If you want the post to have a different value, add a Custom Field RelatedPostsLimit with that value.
Update 2:
You don't insert the code inside
related_posts(), you remove the originalrelated_posts()and replace it with the above code. :)