[random_recent_posts] not pulling random portfolio items

We have the following code on our site in a text module on the homepage.

[random_recent_posts count=“4” category=“Commercial,Industrial,Residential,Educational” type=“portfolio”]

It always shows the same 4 posts and is not randomizing them as the code suggests. Any ideas? Thanks in advance!

Hello Randy,

Thanks for writing in!

Did you added a custom recent posts function in your child theme? You may not have set it to display the items as random. Please check your code:

$posts = get_posts( array(
    'orderby'             => 'rand',
    'post_type'           => "{$type}",
    'posts_per_page'      => "{$count}",
    'offset'              => "{$offset}",
    "{$category_type}"    => "{$category}",
    'ignore_sticky_posts' => $no_sticky
  ) );

orderby by should be set to rand to display random items.

Hope this helps. Kindly let us know.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.