2

Is there a way to display something if there IS NOT a primary category?

We've tried these with no luck:

{exp:primary_category entry_id="{segment_2}"}


{if primary_category_id}
YES 
{if:else}
NO
{/if}

{if primary_category_id} YES {/if}<br>

{if primary_category_id == ""} NO {/if}<br>

{/exp:primary_category}
1

Could you perhaps do...

{exp:query sql="SELECT primary_category_id FROM exp_primary_category WHERE entry_id='{segment_2}'"}
    {embed="site/yes"}
    {if no_results}
        {embed="site/no"}
    {/if}
{/exp:query}

Be careful of placing this inside a channel:entries loop though as the {if no_results} tag will be caught by that instead of the query loop.

Not verified but worth a try.

| improve this answer | |
0

Sorry, this is not available with Primary Category at this time.

| improve this answer | |
  • Any way this might be do-able this an embed or some other such logic? – Nathan Pitman Jun 11 '14 at 7:34

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.