Looking to insert line breaks into Text Area field

Home Forums Calendar Products Events Calendar PRO Looking to insert line breaks into Text Area field

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #986927
    John
    Participant

    Greetings,

    I recently updated my Events Calendar Pro plugin to the 3.10 release and have been testing the new Text Area field that was added to the Additional Fields options. I’m trying to use it write out three rows of text inside the field and have it display that way on the single event page. However, on the event page the value of that Text Area field displays as one long line?

    Is it possible to have the value of a Text Area field display with line breaks?

    #987106
    Nico
    Member

    Hi John,

    Thanks for reaching out! You have a point there, that’s how I would expect it to work myself.

    Hopefully is easy to make this right, just add this snippet to your theme’s function.php file – located at ‘wp-content/themes/your_theme/’:

    https://gist.github.com/niconerd/fd50559fe0179149e894

    Please let me know if it worked for you,
    Best,
    Nico

    #987167
    John
    Participant

    Hi Nico,

    unfortunately, this did not resolve my issue. I did manage to find a way to get the text area to display properly though. Inside of the organizer.php file where I’m calling in these additional fields I added an additional tag.

    In this file the additional tags were being called in like so:

    <?php if ( ! empty( $registration ) ): ?>
                     <dt><?php _e( 'Registration:', 'tribe-events-calendar' ) ?></dt>
                      <dd class="tribe-meta-value registration"> <?php echo $registration ?> </dd>
                  <?php endif ?>
    
    What I did was wrap the contents inside the <dd> inside of a <pre> and then styled the results with CSS. The <pre> allows the text I type into the Text Area input field to display exactly how I type it in.
    
    <?php if ( ! empty( $registration ) ): ?>
                     <dt><?php _e( 'Registration:', 'tribe-events-calendar' ) ?></dt>
                      <dd class="tribe-meta-value registration"> <pre><?php echo $registration ?></pre> </dd>
                  <?php endif ?>

    Again, thanks for the help. And thanks for including this feature with the new release. Its helped me resolve an issue that I’ve been stumped on for weeks now.

    • This reply was modified 8 years, 10 months ago by John.
    • This reply was modified 8 years, 10 months ago by John.
    #987495
    Nico
    Member

    Hi John,

    Great you could work this out 🙂 It’s a nice feature indeed, glad to hear you find it useful.

    I’m going to close this topic – but please don’t hesitate to create new topics if you need help with anything else.

    Have a great weekend,
    Best,
    Nico

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Looking to insert line breaks into Text Area field’ is closed to new replies.