- This topic is empty.
March 22, 2011 at 1:26 pm #32090
Using Theme Options panel in WP to insert content. Here is the array that builds the option:
$options = array( "name" => "Footer Right Content",
"desc" => "",
"id" => $shortname."_footer-right-content",
"type" => "textarea");
That gives me a textarea option on the Theme Options panel to insert content, and that’s all fine and dandy, except that the output is in one paragraph so there’s no line breaks. I need to either create the line breaks or split it up into separate paragraphs. How would I do this?March 22, 2011 at 1:32 pm #54634TheLeggettMember
The wpautop() function might be what you’re looking for: http://codex.wordpress.org/Function_Reference/wpautopMarch 22, 2011 at 1:52 pm #54620
That’s exactly what I need. However, I’m having trouble inserting the string. My php isn’t so good so I’m screwing up the syntax
Here’s the echo that generates the string.
How can I plug this in to the wpautop()?March 22, 2011 at 2:07 pm #54613TheLeggettMember
I haven’t actually used WordPress Theme options before, so this is just a guess. Hopefully someone corrects me here if I’m wrong.
I would assume something like this would work:
$foo = get_option('vn_footer-right-content');
March 22, 2011 at 2:17 pm #54615
The second one worked perfectly. I believe the problem with the first one was that the string wasn’t echoed out first and wpautop() must take a string, not a variable. I think so at least, my php isn’t as good as yours clearly. Thank you for your help :)September 5, 2013 at 2:09 am #149120nizamkaziParticipant
I believe that simpler way it to add
white-space: pre-wrap;in to css set of element which is displaying the result.
And it will start reflecting line-break where you had pressed “Enter” while typing into textarea.
- You must be logged in to reply to this topic.