How do you put a newline or CR in a text calculation?

By: Michele Capurso | Asked: 03/18/2023
ForumsCategory: General questionsHow do you put a newline or CR in a text calculation?
Michele Capurso asked 2 years ago

Hi. I need to set up a rather long text calculation field to recap a bunch of choices made in some previous fields. So:

  1. I created a paragraph filed
  2. I am using the Advanced Default Value (Text Calculation) to populate the field from other fields' content.

Things work pretty well, expect I cannot place newlines between fields code. I have tried things like:

[221]<p>[222]</p>
[221]<br>[222]

[221]\n[222]

[221]\\n[222]

 

Nothing works so far. I even created another paragraph field and placed a newline there, but unless you put some other text content the CR alone gets stripped away.... Any help would be much appreciated!

3 Answers
Michele Capurso answered 2 years ago
Hi and thank you for the idea. Not really what I wanted to achieve, but it could be a solution. I am going to check it right now. 
Victor Font answered 2 years ago
Another technique to try is to create your own shortcode to produce the output you want. With a shortcode, you could append the PHP_EOL character between the lines where you want the breaks.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right