0

Trying to display different link for one entry (thing1) inside channel entries loop.

{exp:channel:entries channel=“things”}

     <h2>{title}</h2>
     <p>{description}</p>

     {if url_title == ’thing1’}
     <a href=“somecustomlink.html”>Read more</a>
     {if:else}
     <a href=“{path=’things’}/{url_title}”>Read more</a>
     {/if}

{/exp:channel:entries}

Problem is, that EE uses to compare {url_title} with current template, not with “things” channel entrie's.

How to write this conditional?

1
  • Is this exp:channel:entries variable pair nested inside another one? – Sobral Feb 5 '15 at 16:51
0

If this exp:channel:entries code block is appearing on a page that is used for displaying a specific entry (e.g. a specific news article page) then try adding a dynamic="no" parameter to the channel:entries tag. Otherwise, I would double-check that Robson hasn't already hit the nail on the head with his 'nested channel:entries' hypothesis.

0

Solved the problem with using {title} instead of {url_title} in conditional.

0

Although not as flexible, I'm adding suggestion to write the conditional using {if segment_x == 'thing1'} as another viable option.

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.