How can I create a custom shortcode that will return a custom post type by ID?
Ok, I found a simple answer to my problem. This is the shortcode function I ended up using to get my desired result: function cpt_case_study_func($atts){ extract( shortcode_atts( array( ‘id’ => null, ), $atts ) ); $post = get_post($id); $content=”<div class=”case-study”><h3>” . $post->post_title . ‘</h3> <p>’ . $post->post_content . ‘</p></div>’; return $content; } add_shortcode(‘case_study’,’cpt_case_study_func’); Thanks to … Read more