Is it possible to create a single alphabetically ordered list containing categories from multiple category groups?
Here is the code I am using:
<ul>
{exp:channel:categories category_group="1|2"}
<li>{category_name}</li>
{/exp:channel:categories}
</ul>Unfortunately this separates the category groups, and I end up with a list such as this:
book graphic identity poster website architecture art David Bowie ExpressionEngine zoos
You’ll notice that it is actually two lists ordered alphabetically. I would like to merge these into one list somehow.
I would expect to be able to add something like orderby= as in the Channel Entries Tag:
<ul>
{exp:channel:categories category_group="1|2" orderby="name"}
<li>{category_name}</li>
{/exp:channel:categories}
</ul>But this does not work. Has anyone come across this before?
Many thanks in advance.
Hi sam,
Have you tried GWcode Categories Plugin?
http://gwcode.com/add-ons/gwcode-categories/documentation
Another method is you can write a simple query using the query module.
Make sure the Query module is installed in your EE CP. This example pulls from category groups 1 and 2 and orders them together.
<ul>
{exp:query sql="
SELECT *
FROM exp_categories
WHERE group_id IN (1,2)
ORDER BY cat_name ASC"}
<li>{cat_name}</li>
{/exp:query}
</ul>Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.