Skip to content

Commit f527fae

Browse files
committed
Fixed #26 where channel entries order by random was not working
1 parent c953453 commit f527fae

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Fixed
66

77
- Prolet and other ExpressionEngine Control Panel URLs were using old admin route
8+
- Channel Entries tag support for random ordering
89

910
## [2.0.0] - 2025-01-14
1011

src/View/Tags/Channel/Entries.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,10 @@ public function run()
367367
foreach ($fields->terms as $index => $field) {
368368
$direction = isset($directions[$index]) ? $directions[$index] : end($directions);
369369
$field = $field->value;
370-
if ($this->fieldtypeManager->hasField($field)) {
370+
371+
if ($field === 'random') {
372+
$this->query->inRandomOrder();
373+
} elseif ($this->fieldtypeManager->hasField($field)) {
371374
$this->query->orderByCustomField($field, $direction);
372375
} else {
373376
$this->query->orderBy($this->query->qualifyColumn($field), $direction);

0 commit comments

Comments
 (0)