Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Thu P. a11n

    (@thup90)

    Found out how

    qba123

    (@qba123)

    Do you have an another solution instead of using <br>?

    • This reply was modified 7 years ago by qba123.
    Plugin Author Johann Heyne

    (@jonua)

    Hi,

    in addition to my basic code example on https://www.ads-software.com/plugins/advanced-custom-fields-table-field/, you can add the PHP nl2br() function to the cell content to convert the native line breaks from the table cell editor into <br> tags.

    echo nl2br( $td['c'] );

    Cheers,
    Johann

    Plugin Author Johann Heyne

    (@jonua)

    To display natural line breaks at the editing tables in the admin area, add the following styles to the admin area.

    .acf-table-header-cont,
    .acf-table-body-cont {
        white-space: pre-line;
    }

    One way to add these styles to the WordPress admin area is adding the following code to your functions.php file of the theme.

    add_action('admin_head', 'acf_table_styles');
    
    function acf_table_styles() {
      echo '<style>
        .acf-table-header-cont,
        .acf-table-body-cont {
            white-space: pre-line;
        } 
      </style>';
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can’t create new lines inside table’ is closed to new replies.