Reputation: 493
I'm trying to create an extra shortcode to display the_content
function custom_recipe_content( $atts ){
if ( ! is_singular( 'recipe' ) ) {
return;
}
return the_content();
}
add_shortcode( 'recipe_content', 'custom_recipe_content' );
When I add the [recipe_content]
shortcode inside a wp text widget, it's added above the widget rather than inside the widget.
Any help is much appreciated.
Upvotes: 1
Views: 3039
Reputation: 493
Found the solution, thanks to TRS:
$content = apply_filters( 'the_content', get_the_content(), get_the_ID() );
return $content;
Upvotes: 2
Reputation: 1015
Try returning
apply_filters('the_content',the_content());
This will implement the content as content.
Upvotes: 0