Skip Navigation

[Resolved] Conditional html broke my code

This support ticket is created 5 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Shane 5 years, 5 months ago.

Assisted by: Shane.

Author
Posts
#1147933

Hello,
I have this code in a content template :

<div class="eltdf-social-share-holder eltdf-list">
<ul>
 	<li>{!{types field='instagram' title='Instagram'}!}{!{/types}!}</li>
 	<li>{!{types field='facebook' title='Facebook'}!}{!{/types}!}</li>
 	<li>{!{types field='youtube' title='Youtube'}!}{!{/types}!}</li>
 	<li>{!{types field='trip-advisor' title='Trip Advisor'}!}{!{/types}!}</li>
</ul>
</div>

Wich work well, but if a field isempty, there is an extra space

Adding conditonal outpout broke my code :

<div class="eltdf-social-share-holder eltdf-list">
<ul>
 	{!{wpv-conditional if="( $(wpcf-instagram) eq '' )"}!}<li>{!{types field='instagram' title='Instagram'}!}{!{/types}!}</li>{!{/wpv-conditional}!}
 	{!{wpv-conditional if="( $(wpcf-facebook) eq '' )"}!}<li>{!{types field='facebook' title='Facebook'}!}{!{/types}!}</li>{!{/wpv-conditional}!}
 	{!{wpv-conditional if="( $(wpcf-youtube) eq '' )"}!}<li>{!{types field='youtube' title='Youtube'}!}{!{/types}!}</li>{!{/wpv-conditional}!}
 	{!{wpv-conditional if="( $(wpcf-trip-advisor) eq '' )"}!}<li>{!{types field='trip-advisor' title='Trip Advisor'}!}{!{/types}!}</li>{!{/wpv-conditional}!}
</ul>
</div>

After saving the code become :

<div class="eltdf-social-share-holder eltdf-list">
<ul>
 	<li style="list-style-type: none">
<ul>{!{wpv-conditional if="( $(wpcf-instagram) eq '' )"}!}
 	<li>{!{types field='instagram' title='Instagram'}!}{!{/types}!}</li>
</ul>
</li>
</ul>
{!{/wpv-conditional}!}
{!{wpv-conditional if="( $(wpcf-facebook) eq '' )"}!}
<ul>
 	<li style="list-style-type: none">
<ul>
 	<li>{!{types field='facebook' title='Facebook'}!}{!{/types}!}</li>
</ul>
</li>
</ul>
{!{/wpv-conditional}!}
{!{wpv-conditional if="( $(wpcf-youtube) eq '' )"}!}
<ul>
 	<li style="list-style-type: none">
<ul>
 	<li>{!{types field='youtube' title='Youtube'}!}{!{/types}!}</li>
</ul>
</li>
</ul>
{!{/wpv-conditional}!}
{!{wpv-conditional if="( $(wpcf-trip-advisor) eq '' )"}!}
<ul>
 	<li style="list-style-type: none">
<ul>
 	<li>{!{types field='trip-advisor' title='Trip Advisor'}!}{!{/types}!}</li>
</ul>
</li>
</ul>
{!{/wpv-conditional}!}

</div>

Thank you for your help

#1148020

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for contacting our support forum.

Could you try adding the

  • tags on the outside of the conditionals instead of having the conditionals wrapping them.

    This should resolve the issue.

    Thanks,
    Shane

    This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.