Home › Forums › Calendar Products › Events Calendar PRO › Looking to insert line breaks into Text Area field
- This topic has 3 replies, 2 voices, and was last updated 8 years, 10 months ago by Nico.
-
AuthorPosts
-
July 16, 2015 at 5:38 am #986927JohnParticipant
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?
July 16, 2015 at 11:49 am #987106NicoMemberHi 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,
NicoJuly 16, 2015 at 2:29 pm #987167JohnParticipantHi 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.
July 17, 2015 at 2:06 pm #987495NicoMemberHi 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 -
AuthorPosts
- The topic ‘Looking to insert line breaks into Text Area field’ is closed to new replies.