I've got a navigation structure where I'm using the Title as the main navigation menu item and then using grid for any submenu items. So what I basically want to do is something like this:

{if "{submenu:field_total_rows}" == "0"}{if:else}Show the submenu{/if}

I've tried multiple variations on the above row - but both empty and non-empty submenus are behaving the same way. I'm sure its just a syntax issue but I can't find what is is.

3 Answers 3


If submenu is the grid fieldtype name, then all you need is:

{if submenu:total_rows > 0}submenu contents{/if}

You may need to add quotes and brackets around the condition if the above doesn't work


I tried a billion combinations as well. This is how I used it for meta data (functional):

{if articles_seo_meta_data:total_rows > 0}

Say you had a grid field named 'submenu' with 3 columns in it. One dropdown named 'Target' and two text fields named 'Link', and 'Text'.

You need to see if there are rows first like this:

{if submenu:total_rows > 0}

Then open the grid field and loop through the rows like this:

    Your data...

You would end up with something like this, depending on your markup and what you choose to qualify:

{if submenu:total_rows > 0}
    <ul class="subnav">
            <li class="subnav-item">
                <a {if "{submenu:link"}!=""}href="{submenu:link}"{/if}{if "{submenu:target}"=="External"} target="_blank">{if "{submenu:text}"!=""}{submenu:text}{/if}</a>
  • @Boshy start a new question and let me know where it is. I'll gladly help. ;)
    – W3bGuy
    Dec 20, 2014 at 21:28
  • Thanks @Brian Mallett and apologies for slow response (Xmas holdup!). My comment here about my issue seems to have disappeared, no idea why. I've started a new question as I haven't been able to solve the issue.It's here: expressionengine.stackexchange.com/questions/27313/…
    – Boshy
    Jan 6, 2015 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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