I'm trying to create a taxonomy terms list with glossary view. Normally, everything is working (page view, attachment, contextual filter (glossary view) etc).

My taxonomy terms are full names, such as: Ali Veli, Mehmet Zeki

In glossary view it seperates the letter with the first letter and it seems like that:

A | B | C | ... | M | ... | Z


Ali Veli



Mehmet Zeki

I want to sort all the terms by surnames (last word of term) instead of names (first word of term).

A | B | C | ... | M | ... | Z


Veli, Ali



Zeki, Mehmet

If I don't use the contextual filter and glossary view I could use Views PHP and do what I want as this:

1. I added the Taxonomy Term: Name field.

2. I added a Global: PHP field.

This is the value code:

$exploded = explode (" ", $row->name);
$exploded_last = array_pop($exploded);
$eachone = $exploded_last .', ' .implode(' ', $exploded);
return $eachone;

This is the output code:

<?php print $value; ?>

3. I added a new Global: PHP sorting field to Sorting Criteria.

This is the sort code:

if ($row1->php < $row2->php) return -1; else return 1;

This method is working good (without contextual filter & glossary view) and gives the results as this:

Veli, Ali

Zeki, Mehmet

How can I use such a method for glossary view?

  • Any idea for this? I can't use this method for glossary views. – herci Dec 28 '14 at 17:41
  • Can you build a View to do what you want? – Brady Aug 20 '15 at 12:45
  • @Brady, sorry couldn't understand. What do you mean by "Can you build a View to do what you want?" – herci Aug 20 '15 at 13:36
  • Can you build a View in Views to do what you want? If you can then there are ways to override Taxonomy displays with views. – Brady Aug 20 '15 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.