Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I found a great article on Custom Taxonomies here. I have a specific requirement related to ordering values entered in the Custom Taxonomies. How do I display the terms entered in the meta boxes in the order I entered them and “NOT” in alphabetical order.(ex. If I enter Edward, Linda, Arnold in meta boxes, how do I NOT display them Arnold, Edward, Linda).

Thanks in advance. Any help would be greatly appreciated.

share|improve this question
add comment

1 Answer

To print its categories that article uses the function wp_list_categories. The parameter that dictates how elements are ordered is "order_by" which it sets to "name". Other options are listed under parameters, order by, on that function's page in the codex: http://codex.wordpress.org/Template_Tags/wp_list_categories

It seems that the option you have are ID, name, slug, term_group and count. Anything else will require more work than just changing a parameter. The solution might depend on what kind of sorting you are looking for.

share|improve this answer
    
Calle, thanks for your response. I tried changing the name to "id" for the orderby and it does exactly what I want. But the problem is that it displays "all" the taxonomies terms. I want to display only the ones specific to my custom post. I am currently using "get_the_term_list" method but it displays taxonomy terms in alphabetical order. –  user19569 Oct 16 '12 at 14:45
    
get_the_term_list is a helper function that retrieves terms and prints them in a list. The best you can do if you want to change the order is to use wp_get_object_terms (codex.wordpress.org/Function_Reference/wp_get_object_terms) and print the list yourself as in the example on the page I just gave a link to. It takes a list of arguments, of which one is orderby, just like wp_list_categories. –  Calle Oct 16 '12 at 23:55
    
Nice! That method was exactly what I needed and has worked out for me. Thanks. –  user19569 Oct 22 '12 at 13:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.