Skip Navigation

[Resolved] Conditional content adding line breaks

This support ticket is created 5 years 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by paul 5 years ago.

Assisted by: Christian Cox.

Author
Posts
#1377473
template.jpg

I want to just display lots of fields (only 50% are populated). The problem is that the output adds line breaks if there is no content. I looked at forums and they say that the content template should be set to raw, which I have done

On the template page is have set the output mode to Manual paragraphs, but it still gives breaks

here is the code a snippet of the code.............

  • [wpv-conditional if="( $(wpcf-bathrooms) ne '' )"]Bathrooms: [types field='bathrooms' output='raw'][/types][/wpv-conditional]
  • [wpv-conditional if="( $(wpcf-square-metres) ne '' )"]Size: [types field='square-metres' output='raw'][/types]m2[/wpv-conditional]
  • [wpv-conditional if="( $(wpcf-postcode) ne '' )"]Postcode: [types field='postcode'][/types][/wpv-conditional]
  • [wpv-conditional if="( $(wpcf-building-name) ne '' )"]Building Name: [types field='building-name'][/types][/wpv-conditional]
  • [wpv-conditional if="( $(wpcf-location) ne '' )"]Location: [types field='location'][/types][/wpv-conditional]
  • This code is set within a beaver builder template.

    #1377501

    Hi, it looks like the li tags are placed outside the conditionals, based on the code I can see here. Without being able to see the problem on the front-end of the site, I'm just guessing though. My first suggestion is to move the list item tags inside each conditional:

    [wpv-conditional if="( $(wpcf-bathrooms) ne '' )"]<li>Bathrooms: [types field='bathrooms' output='raw'][/types]</li>[/wpv-conditional]
    

    If that does not solve the problem, I'll need to see the output on the front-end of your site to make some other recommendations. Please provide a URL where I can see the problem.

    #1380525

    My issue is resolved now. Thank you!

    I just started to use the block editor for everything