Support

Account

Home Forums Bug Reports Auto BR is broken?

Solved

Auto BR is broken?

  • I have the “convert new lines into br/ tags option set on my textarea fields but this is not working at all. No br/ tags are inserted into the HTML so everything displays as one long string.

    I’ve tried manually adding extra blank lines between each line of text, but it makes no difference to how it displays, as the browser naturally ignores extra whitespace.

  • Using the latest version of the plugin (4.3.3) as well as WordPress (3.8)

  • Here’s my temporary workaround until the developer issues a plugin fix.

    In my template, where I insert the value of the textarea, I insterted a PHP nl2br().

    $my_textarea = get_post_meta(...);
    
    //echo $my_textarea; // instead of this
    
    echo nl2br($my_textarea); // do this
  • Hi @Sparky672

    The issue here is that you are using the function get_post_meta instead of the ACF get_field equivalent.

    You MUST use get_field to allow for value formatting such as ‘auto br’

    Thanks
    E

  • Ok thanks! Sorry for the trouble.

  • I’m having this same problem even though i use get_field.

    Im using elegantthemes theme and have a learn_more shortcode run if user types details in acf text area field. The content inside act text area field is then passed in to learn_more shortcode but it’s missing those automatic <br> line breaks.

    Here is my php

    <?php
    $onko_lisatietoja = get_field(‘lisatiedot’);
    if($onko_lisatietoja!=”){ ?>

    <?php echo do_shortcode(‘[learn_more caption=”Lisätietoja”]’.get_field(“lisatiedot”).'[/learn_more]’); ?>

    <?php } else { ?>

    <?php } ?>

  • Hi @jukka

    I can assure you that the nl2br setting on the textarea works, so there must be something else going on here.

    perhaps you could test the textarea prior to the shortcode like so:

    
    <p><?php the_field('lisatiedot'); ?></p>
    

    Does this contain the br tags?

  • Hi,

    I had a similar problem,
    The formatting is removed when the_field or get_field is used in an archive-template. I tested it on 2 themes same result. bones and twenty-eleven.
    both functions work fine in a page-template an probably in a single-template. the nl2br() solution works for me
    `<p><?php echo nl2br(get_field(‘cv’)); ?></p>
    hope it gets fixed.

    B

  • I am using acf pro latest version and wordpress latest version but still having the same issue. In order to fix the kind of problem there are so many hacks like: str_replace, nr2br..etc but these are not proper solution in order to fix it.

    If i use “shift+enter” then it adds “br” within “p” tag but i wanted to use it after closing the “p” tag.

    Again i used acf filter hooks in order to customize editor to add “br” tag but it didn’t work for me.

    So please provide some kind of filters or option in editor to do the kind of job.

    Thanks!!

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Auto BR is broken?’ is closed to new replies.