I have created a view of a repeatable group of fields and wanted to show on a page. The views are working fine. But when I put labels before the values generating from custom fields, the line is breaking after the label. I have used the following code
<h3>Name of the Post: [types field="post-name"][/types]</h3>
<ul>
<li>No. of Vacancies: [types field="vacancies"][/types]</li>
<li>Uppre Age Limit: [types field="upper-age-limit"][/types]</li>
<li>Educational Qualification: [types field="educational-qualification"][/types]</li>
<li>Work Experience: [types field="work-experience"][/types]</li>
<li>Pay Scale: [types field="pay-scale"][/types]</li>
</ul>
Things are generating in a different way. You can understand the problem from the attached screenshot.
In the Content Template or Template Loop Item where you added that code, uncheck the "Auto-insert paragraphs" option and select "Manual paragraphs" instead - that is one part that can solve the issue of unexpected P tags or breaking tags
Another part is outputting the Field in "Raw" mode (output="raw"). That ensures the Fields are only outputting values and no HTML.
It seems you need to do this only for [types field="educational-qualification"][/types], [types field="work-experience"][/types]
Maybe those are WYSIWYG or other HTML carrying fields? Then it's expected for them to output in certain wrapping HTML.
You can ultimately also try to wrap content into "[wpv-noautop]CONTENT HERE[/wpv-noautop]" ShortCodes, this ensures that anything within is rendered without HTML applied.
Please let me know which of the options solved the issue, or if you still see the problem after all changes applied.
See for the 'Educational Qualification' and 'Work Experience' fields I am using 'multiple lines; custom fields whereas in other cases either I am using number or single line custom fields.
I have tried all the tricks including generating views out of the customs in an unformatted way but its adding paragraph tag for those two fields. But when I keep the custom field of a 'single line' nature, the problem doesn't persist (keeping the custom field of 'multiple lines' nature is my compulsion).
See the screenshot.
Multiple Lines Fields accepts HTML when edited in a Post
Do your Multiple Lines Fields hold any HTML?
Even if you just break line in the Multiple Lines Field, this will (natively) be respected on the Front end, so it will look like when inserted in the backend.
Each Multiple Line Custom Field will output a P tag, in it several BR tags to separate the lines in the Field.
However, as I mentioned earlier, if you select raw output when inserting this ShortCode, then the P tag is not produced.
The ShortCode with raw output can be generated by the GUI when inserting it, and this is how it should look alike:
[types field='multi-line-field-slug' output='raw'][/types]
As soon this is done, no more P tag will be wrapping the content of that Multiple Line, neither will the line breaks in the field apply, of course, as now it's "raw", and only really saved values of the field will be shown/returned.
Hence if you still see the issue with the raw turned on, then the problem is in the content of your Multiple Lines field, since if you add valid HTML there, it won't be removed by the raw attribute.
Then, you need to change the HTML in the content of the Multiple Lines field.
My issue is resolved now. Thank you!