Forum

Thread tagged as: Blog

Perch Blog Custom: Sort order random, but exclude current post

Hi,

At the end of a blog post I would like to include more recommended reading. Right now I'm simply using the Perch Blog Custom with a random order. It's working really well, except I would like to exclude the current URL or post from the list. Is there a way to filter this? Here's my code:

<?php  
                                        perch_blog_custom(array(
                                          'count'      => 3, 
                                          'template'   => 'post_in_list.html',
                                          'sort'       => 'postDateTime',
                                          'sort-order' => 'RAND',
                                          'paginate' => false,
                                        ));
                                        ?>

Thanks!

Greg Stone

Greg Stone 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you can filter for posts where the slug is not equal to the current post's slug.