Space Retention from TextArea in Options Framework Plugin for WordPress

I am using the latest version of Options Framework (which is found here: http://wordpress.org/extend/plugins/options-framework/) on the latest build of WordPress to build out some theme options/controls. In a text area, I am asking the user for something that is best output via multiple paragraphs. I want to retain the spacing they specify in this textarea.

I output their option in via shortcode and all spacing is lost. I also output it via an echo and all spacing is lost. So it seems the spacing loss is occurring between input and storage.

Read More

THanks for any help!

Related posts

Leave a Reply

1 comment

  1. i just tested this locally… the plugin maintains line breaks in the option’s textarea, so the problem must be w/ how you are displaying it.

    wordpress doesn’t save p tags in the database, normally so they won’t get saved by Devin’s plugin. the function wpautop() is attached to the_content filter and it (sometimes seemingly willy-nilly, but that’s a different discussion) determines what should be wrapped in p tags.

    what if you

    echo wpautop(of_get_option('test'));
    

    something i came up w/ for a similar issue w/ textareas in metaboxes is to create a filter and attach the normal content filters to that… a “duplicate” the_content if you will. i started out straight up using apply_filters(‘the_content’ $my_value) but some plugins hook into that filter and it can get weird.

    echo apply_filters('meta_content',of_get_option('test'));
    

    then somewhere in your functions.php

    //recreate the default filters on the_content
    add_filter( 'meta_content', 'wptexturize'        );
    add_filter( 'meta_content', 'convert_smilies'    );
    add_filter( 'meta_content', 'convert_chars'      );
    add_filter( 'meta_content', 'wpautop'            );
    add_filter( 'meta_content', 'shortcode_unautop'  );
    add_filter( 'meta_content', 'prepend_attachment' );