3

I am adding tinymce edior with new wp_editor() function on theme option page. On submit the theme option sends data to option.php where it saves. But tinymce doesn't seem to convert the line breaks into <p> tags as we see in the post and pages from the edit page. Other styles and htmls that I add from the editors are okey.

Do i have to use any filter on it before it saves?

I am showing the content with a echo.

<?php echo theme_option('homepage_content'); ?>
2
  • 1
    Paragraphs aren't added to the content, they're added on display only, your issue is with how you display the data you're saving, what are you using to display the data? Just a regular echo? Something else? Please add those details to your question.
    – t31os
    Commented Dec 21, 2011 at 13:07
  • @t31os: updated my question.
    – Sisir
    Commented Dec 21, 2011 at 13:21

1 Answer 1

5

If you want the contents of an option, variables, or anything for that matter to be treated like post content you'll need to call the post content filters.

<?php echo apply_filters( 'the_content', $your_var ); ?>

Your data is then treated in the same way as post content is, inline with the code sample you've posted, the call should go like this..

<?php echo apply_filters( 'the_content', theme_option('homepage_content') ); ?>

Hope that helps. :)

2
  • working now.. I am so dumb when it comes to filter :( Thanks anywayz!
    – Sisir
    Commented Dec 21, 2011 at 13:50
  • Amazing - worked like a charm :)
    – Jodyshop
    Commented Nov 19 at 0:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.