Showing a random structured item

Hi all - I have structured items defined in my panel, and want to show one row of data randomly on each page reload, but am having trouble. Must be a silly thing I’m doing, so hoping for some help!

site.yml

testimonials:
        type: structure
        label: Testimonials
        fields:
          testimonial:
            label: Quote
            type: writer
          citation:
            label: Citation
            type: text

Frontend:

<?php $featuredTestimonial = $site->testimonials()->toStructure()->random(); ?>

<?= $featuredTestimonial->quote()?>
<?= $featuredTestimonial->citation()?>

Not showing any results and I’ve tried several options with no luck! Thank you in advance.

That method does not exists, use shuffle()->first() instead.

Ah thank you so much, all working! :slight_smile: