- This topic is empty.
-
AuthorPosts
-
March 22, 2011 at 1:26 pm #32090
noahgelman
ParticipantUsing 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 #54634TheLeggett
MemberThe wpautop() function might be what you’re looking for: http://codex.wordpress.org/Function_Reference/wpautop
March 22, 2011 at 1:52 pm #54620noahgelman
ParticipantThat’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 #54613TheLeggett
MemberI 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:
Or…
$foo = get_option('vn_footer-right-content');
echo wpautop($foo);
?>
March 22, 2011 at 2:17 pm #54615noahgelman
ParticipantThe 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 #149120nizamkazi
ParticipantI 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.
-
AuthorPosts
- You must be logged in to reply to this topic.