How I can sort taxonomy terms by name in Taxonomy MENU?

Comments

giupenni’s picture

I try to explain me better.
I want sort the items of Taxonomy Menu in accord with the Taxonomy sort.
When in Taxonomy I sort terms alphabetically, I want the same order in Taxonomy Menu.

Is it possibile?

Thank You. :-)

dstol’s picture

Status: Active » Postponed

This feature doesn't currently exist. Not that it's not a good idea.

giupenni’s picture

I think will be a good ijdea

johnv’s picture

jbd44’s picture

This is how I did it programatically:

// Load 'Tags' vocabulary (vid of 'Tags' = 1).
$tags = taxonomy_get_tree(1);

// Iterate over the vocabulary object and push terms onto array where key is
// tid and value is name, then sort the array alphabetically.
$tags_alphabetical = array();
foreach ($tags as $tag) {
  $tags_alphabetical[$tag->tid] = $tag->name;
}
asort($tags_alphabetical);

// Iterate over the ordered array and push terms onto array as links.
$items = array();
foreach ($tags_alphabetical as $tid => $name) {
  $items[] = array(
    'data' => l($name, 'taxonomy/term/' . $tid),
  );
}

// Pass through theme function.
if (empty($items)) {
  $list = t('No tags available.');  
} else {
  $list = theme('item_list', array('items' => $items));
}
return $list;
vladimiraus’s picture

Issue summary: View changes
Status: Postponed » Closed (outdated)

Thank you for your contributions.
Drupal 7 is no longer supported.
Closing this issue as outdated.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.