ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

orderby category_name in Channel Category Archive

March 15, 2012 12:20pm

Subscribe [2]
  • #1 / Mar 15, 2012 12:20pm

    Environ-IT

    26 posts

    I want to list the channel categories in alphabetical order, i.e. by category_name, but I’m not sure how to do it.
    Can it be done?
    The code below doesn’t seem to be right.

    {exp:channel:category_archive orderby="category_name" channel="case_studies" style="linear"}
     {categories}
         <li>   <a href="http://{path=site/client_stories}">{category_name}</a></li>
     {/categories}
    {/exp:channel:category_archive}

    Thanks

    Andrew

  • #2 / Mar 16, 2012 1:28am

    the3mus1can

    426 posts

    You can use the query module to do this.  Something like this should work:

    {exp:query sql="SELECT cat_name, cat_url_title FROM exp_categories WHERE group_id = ...category group id to scope the categories by… ORDER BY cat_name"}
    
     {cat_name}
    
    {/exp:query}
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases