jacobmdeboer Posted July 8, 2015 Share Posted July 8, 2015 Hi! I currently have some text that I want to add a line break to every 100 characters.The problem I have is that the text is inside of a shortcode and I am not sure how to wordwrap it from inside that shortcode.Here's the code:<?php echo do_shortcode('[myshortycode]This is the text I want to add line breaks to[/myshortycode]') ?> Quote Link to comment https://forums.phpfreaks.com/topic/297227-wordwrap-help/ Share on other sites More sharing options...
scootstah Posted July 8, 2015 Share Posted July 8, 2015 So you want to add a shortcode to wrap text? Or you want to wrap text before it is parsed by another shortcode? Quote Link to comment https://forums.phpfreaks.com/topic/297227-wordwrap-help/#findComment-1515864 Share on other sites More sharing options...
CroNiX Posted July 8, 2015 Share Posted July 8, 2015 Wouldn't it be better to just do that with a css fixed-width container so the text wraps naturally? If you hard chop the text at 100 chars, it will, most likely, cut some words in half. I'd assume you'd want it to only break on spaces and not in the middle of a word. That can of course be done with PHP, but a fixed-width container is a lot simpler. Quote Link to comment https://forums.phpfreaks.com/topic/297227-wordwrap-help/#findComment-1515867 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.