I am working with three Relationship fields and I would like to be able to display a section only if there are any related articles in that section.

I tried this without success:

{if related_tips != ""}
  <h3>Related Tips</h3>
      <li><a href="{site_url}in_the_garden/decorating_tip/{related_tips:url_title}">{related_tips:title}</a> </li>

I would appreciate some guidance on how this should be done.


  • Try removing the != '' part of your equasion Commented Mar 7, 2014 at 6:30

1 Answer 1


Try using the count and total results variables, but namespaced with the name of your relationship field:


    {if relationship_field:count ==1}


    {if relationship_field:count == relationship_field:total_results}

  • Hi Michael, That appears to solve the problem. I am not sure I totally understand the logic behind the conditionals around the <ol>. If you could share a tad more on that, I would appreciate it. Also, I would like to thank you for your amazing tutorials. It was your Small Business site tutorial that I went through in 2008 that turned the EE lightbulb on in my mind. Since then I have built more than 50 EE sites and will always be grateful for your teaching.
    – forrest
    Commented Mar 10, 2014 at 14:23
  • Basically this logic is saying "only spit out the ordered list markup if there are going to be items in the list". It's just a way to ensure that you would never get empty <ol></ol> markup in your rendered code. And thanks for the comments - always good to hear as I look at another necessary edit of the book..;) Commented Mar 10, 2014 at 17:59

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.