• Resolved Eccola

    (@eccola-www)


    Hello,
    when using WYSIWYG custom field, it outputs text raw, without <p> -paragraphs. This is very bad for my clients, who don’t know HTML. I’m using <?php echo get_post_meta($post->ID, 'wpcf-wysiwygfield', true);?> in my templates. Is there a way to activate the ‘auto p’? Otherwise, everything works nice, thank you.

    http://wordpress.org/extend/plugins/types/

Viewing 5 replies - 1 through 5 (of 5 total)
  • you have to apply the autop and probably the other filters that are normally applied to the_content() to the data you retrieve from get_post_meta.

    this is why i usually do in similar situations:

    /* @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' );

    then change your code to:

    <?php $text = get_post_meta($post->ID, 'wpcf-wysiwygfield', true); ?>
    <?php echo apply_filters('meta_content',$text); ?>
    ?>

    edited: nm.

    Thread Starter Eccola

    (@eccola-www)

    Thanks for the tips helgatheviking! I will try this, and certainly will read the plugin documentation this time.

    sure thing. it probably isn’t in the plugin docu. it is a trick i learned when doing metaboxes with WP Alchemy. remember that WP does not save the paragraph tags in the database. it automatically applies them with the wpautop filter based on line breaks. so any time you want to your front end code to match what you see in the_editor you must run it through that filter.

    thx helgatheviking, really saved my day with this solution 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Types – Custom Fields and Custom Post Types Management] WYSIWYG auto p?’ is closed to new replies.