0

I'm trying to output a category group and its respective entry listing titles (in this case the titles are names of people) in alphabetical order by last name in a menu navigation like so. To do this, I've created a custom field called last_name thinking I could use this tag orderby="last_name, but because category_archive doesn't support this parameter, I'm not able to accomplish this way.

  • Category 1
    • Jon Doe
    • Jane Doe
    • Janet Doe
  • Category 2
    • Jon Doe
    • Jane Doe

Here's the code I have:

<ul class="list-unstyled main-list">
    {exp:channel:category_archive channel="speakers" style="linear" backspace="7" show="not 28}
        <li>
            {categories}
                <a class="btn-open" href="#">{category_name}</a>
            {/categories} 
            <ul class="list-unstyled"> 
                {entry_titles}  
                    <li><a href="{path='site/speaker'}">{title}</a></li>
                {/entry_titles}     
            </ul> 
        </li>   
    {/exp:channel:category_archive}     
</ul>

Is there any other way to accomplish so I can get a bit more flexibility. Perhaps playa or some other plugin or native code? Any help is much appreciated.

2

Sure, something like this:

{exp:channel:category_archive channel="my_channel" style="linear"}
    {categories}
            <h3>{category_name}</h3>

        {exp:channel:entries channel="my_channel" category="{category_id}"}
            <a href="{comment_url_title_path}">{title}</a>
        {/exp:channel:entries}

    {/categories}
{/exp:channel:category_archive}
| improve this answer | |
  • added my custom field to use for sorting and worked great, orderby="last_name" search:navigation_exclude="not y" sort="asc". Thank you for the help! – frshjb373 Jul 24 '15 at 15:26
  • I just realized my the urls of my entries are outputting example.com/site/speaker/C1, using the template path {path='site/speaker'}. Any idea how to resolve issue? – frshjb373 Jul 31 '15 at 16:43
  • Disregard, duh! Used this and working fine, {url_title_path='site/speaker'} – frshjb373 Jul 31 '15 at 16:51

Your Answer

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

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