0

I have a sidebar on my website that lists categories and should list the most recent entry under that category, and this is working great. My issue is that I have entries that use multiple categories, and when this is the case, the loop I created will spit out that entry for each category. So what I am asking is - is there a way to prevent this from happening. Maybe something that checks if that entry has been used in the loop before?

Here is the code I am using

{exp:channel:categories channel="columns" category_group="2" orderby="asc"}
        <div class="colCont">

    {exp:channel:entries channel="columns" category="{category_id}" limit="1"}
            <div id="colThumb"><img src="{if teaser-thumb}{teaser-thumb}{if:else}/uploads/thumbLogo.jpg{/if}" /></div>
            <div id="colTeaser"><p id="colTitle">{category_name}</p>
            <div id="colteaserCont">{column-teaser}</div>
    {/exp:channel:entries}

        </div>

  <div class="clear"></div>
{/exp:channel:categories} 
2
  • How would you determine which category to show an entry under if it was assigned to more than one category? Would your logic be that an entry is only shown in the first category to which it has been assigned? – foamcow Dec 10 '13 at 12:40
  • Would devot-ee.com/add-ons/primary-category help? – Bluedreamer Dec 20 '13 at 6:31

Your Answer

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

Browse other questions tagged or ask your own question.