GeekShop blog 'Other Posts You May Like' section issue
Hi Admin,
I've added about 20 blog posts, and 'Other Posts You May Like' displays ONLY the first 4 blog posts I've added. Should it display randomly 4 posts out of all blog posts? If not, how can I achieve this?
Good call :) You're right.
I'll add this fix in the next update. In the meantime you can change line 20
inside of app/Http/Controllers/PostController.php
from:
$random_posts = Post::where('id', '<>', $post->id)->take(4)->get();
to:
$random_posts = Post::inRandomOrder()->where('id', '<>', $post->id)->take(4)->get();
And you should be good to go. Thanks!
Talk to you soon.