We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [random]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
36 views

weighted random order

I have a field in a channel called "weight" where the user can set a number between 0-1000. On page load I want to generate a random number between 0 and "weight" for each entry, and then sort the ...
3
votes
3answers
352 views

Pagination with randomly ordered entries

I have a need to list a set of entries 9 at a time but with a random order. The pagination happens via Ajax, with each next set of 9 entries loaded onto the page when the user clicks the "See more" ...
2
votes
1answer
283 views

Get an image from a random entry

I have a section with an text field and an image field. the asset field may sometimes be left blank. in this case, in my template, i want to grab the image from another random entry. This is the code ...
1
vote
1answer
256 views

Random posts displayed but exclude current entry ID

I am brand new to Craft and can't find much support on this problem online. I have my entry pages and at the bottom of them, I have a div with the code below in it which randomly links to any entry. ...
1
vote
1answer
131 views

Retrieve entries by random sort, then resort alphabetically

I need to pull X entries with {% set randEntries = craft.entries.section('presenters').order('RAND()').limit(10) %} But then sort them alphabetically on entry.lastName. Do I need to Supersort for ...
2
votes
1answer
87 views

Selecting a random entry based on conditional

I'm trying to select 1 random entry out of a section based on whether a field has content (schedulerBio). I can get all the entries based on the conditional but can't seem to randomize a single ...
1
vote
1answer
112 views

Pull random image from entries marked with a certain category

I am trying to pull an image from services marked with a category of left. I would only like to display one image. I would also like to randomize the image if possible from all the images marked left. ...
2
votes
1answer
85 views

Adding a random entry to an array

I have a navi on which one entry consists of a random channel entry from one section among standard singles: Single 1 Single 2 Random Channel entry Single 3 I thought about something like this: {% ...
1
vote
1answer
1k views

Apply 'random' to an array

How do I output one random line of an array? {% set img = [ { bildli: 'http://i.giphy.com/I0xDz0htjsiME.gif' }, { bildli: 'https://i.giphy.com/fA3JALhIi5YVa.gif' } ] %} {% for item in img %} ...
1
vote
1answer
144 views

Random quotes in matrix block type

I have a Matrix block with 2 types: quotes and text. The first block contains a quote and a text. The second and following ones only contain quotes. I want the type text to be limited to 1 and the ...
1
vote
1answer
157 views

Random Field Entries

I am working on a site for a client who posts many jobs for chefs. A lot of the jobs are essentially similar, so writing the job postings is something I am trying to simplify. I can write a series ...
2
votes
1answer
426 views

How can I limit the output of assets randomly if an asset exists?

How can I limit the output of assets based on this criteria? search all entries randomly in section "homes" for only entries with at least one asset image limit those results to 8 random assets I ...
3
votes
1answer
861 views

Can random be used for ordering with related/assets, in cached code?

I'm trying to determine if I can update this: {% cache %} [ {% set tags = craft.tags.group('color','season','style','venue').limit(null) %} {% for image in craft.assets.relatedTo(tags).order('...
3
votes
2answers
517 views

Output random blocks from a matrix but without the first

I have quotes inside a global matrix which i want to output randomly on the homepage but without the first quote-block. this does not work: {% set quotes = city.cityBlocks.offset(1) %} {% set ...
6
votes
2answers
863 views

How do I get a random entry's URL from a Entries field?

I have a Entries field and I'd like to return a URL for one randomly picked entry. I could loop through all the entries, but I'd like to do something more efficient. Can I return an array of URLs? Or ...
14
votes
2answers
2k views

How can I return data from a Matrix field in random order?

I have a slideshow with slide data managed in a Matrix field. How would I go about randomizing the data returned in the template so the slides show in a different order on each page load?