Hey there,
I’m trying to create a shortcode to display the content of the latest post in a page. When I write the post with the classic WP editor ie plain text/html all is well, but when the post is created with the pro builder I get {{base64content “” }} in my page.
I’m using the latest version of pro and my custom code is:
function latest_post_content_shortcode_handler( $atts, $content = null ) {
$args = array( 'posts_per_page' => 1 );
$custom_query = new WP_Query( $args );
if ( $custom_query->have_posts() ) :
while ( $custom_query->have_posts() ) : $custom_query->the_post();
$output = get_the_content();
// $output = the_content();
// $output = x_get_view( 'global', '_content' );
return $output;
endwhile;
endif;
wp_reset_postdata();
}
add_shortcode('latest_post_content', 'latest_post_content_shortcode_handler');
As you can see I tried the_content(); instead of get_the_content(); & also x_get_view( ‘global’, ‘_content’ );
Why doesn’t the cornerstone content get rendered before output?
Richard