How to enable shortcodes in a custom post type?

Question

How can I enable shortcodes on a custom post type that doesn’t use the_content() or get_the_content()?
In the template file it uses

<?php echo nl2br( $post->post_content ); ?>

to get the content from the backend like any other post or page would.
I have tried using

<?php echo do_shortcode(get_post_field('post_content', $postid)); ?>

which works but the shortcode itself is still displaying for example:


displays above the gallery photos.

0
, Peter 4 years 2020-03-05T19:53:17-05:00 0 Answers 120 views 0

Leave an answer

Browse
Browse