Sorting Tags Alphabetically

Hey there,

is there a way of sorting Tags alphabetically?

I’m trying to sort all my clients…

 <?php foreach ($page->clients()->split(', ') as $category): ?>
  <?= $category ?>
  <?php endforeach ?>

Thanks in advance!

$page->clients()->split(', ')

gives you an array with you can then sort with any PHP’s sort functions:

$tags = $page->clients()->split(', ');

foreach($tags as $category) {
  // do stuff
The sort function accepts different flags as second argument.

1 Like

Thank you!

I solved my problem and used implode to seperate the items in the array.

$tags = $page->productions()->split(', ');
echo implode(', ', $tags);