Ecotrust / ocs-wp

Worpress Implementation of ODFW's Oregon Conservation Strategy
Other
1 stars 0 forks source link

Make sure all textbox and wysiwyg fields are set to process shortcodes #3

Closed willthemoor closed 8 years ago

willthemoor commented 9 years ago

The compass shortcode can come through any CMB textarea (not just WYSIWYG areas). Ensure that all text areas process shortcodes.

Can add a custom function to the site plugin along the lines of

function odfw_get_wysiwyg_output( $meta_key, $post_id = 0 ) {
    global $wp_embed;

    $post_id = $post_id ? $post_id : get_the_id();

    $content = get_post_meta( $post_id, $meta_key, 1 );
    $content = $wp_embed->autoembed( $content );
    $content = $wp_embed->run_shortcode( $content );
    $content = do_shortcode( $content );
    $content = wpautop( $content );

    return $content;
}

// USE:
echo odfw_get_wysiwyg_output( 'wiki_test_wysiwyg', get_the_ID() );
willthemoor commented 8 years ago

Think this is pretty much in place. Moving to beta/post launch but keeping ticket in case we here from the team that something is awry.