Randomly Show Drupal Content or Users in Views

Randomly Show Drupal Content or Users in Views
One of our members wanted to randomly sort their Views results.

Fortunately, because random sorting is a core Views feature, it is very easy to do

  • Go Structure > Views > Add new view. In this example, I’m going to randomly sort my site’s user profiles:
Creating a Drupal view with a random sort criteria
  • Click “Add” next to “Sort Criteria”:
Adding a random sort criteria to Drupal views
  • Search for the setting, “Global: Random”.
  • Click “Apply (All displays)” twice.
Global: Random as a Drupal sort criteria in Views
  • Save your view.
  • Every time you see the view in action, it will now sort randomly from all the available users or content.

Author

  • Steve Burge

    Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.

    View all posts
0 0 votes
Article Rating
Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
J.
J.
3 years ago

Hi Steve! Great tutorial. I’m encountering an issue, however. When I refresh the page, the same results appear. Then, if I clear the cache, (or presumably if I wait a few hours) and refresh the page again, only then do I get new random values. Any ideas on how to resolve this?

Rod Martin
3 years ago
Reply to  J.

Hi J,
yes – that’s easily fixed as well.
Click on the Advanced dropdown -> Caching and change Tags to None.

That’s it!

Rod

2
0
Would love your thoughts, please comment.x
()
x