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 help from Kyle on this post
Related Posts:
- Custom media upload content for inserting custom post shortcode
- Frontend editing, Frontend user dashboard
- Making a Template for a CPT created by a plugin
- Redirect to another page using contact form 7? [closed]
- Tips for using WordPress as a CMS? [closed]
- Adding a Taxonomy Filter to Admin List for a Custom Post Type?
- Custom Post Type Templates from Plugin Folder?
- How to add a shortcode button to the TinyMCE editor?
- Implementing a CrunchBase.com Clone using WordPress?
- How to customise the output of the WP image gallery shortcode from a plugin?
- How to include code only on specific pages?
- Redesigning Custom Post Type “Add New” page
- How to Remove Certain Screen Options and Meta Boxes from add/edit post type?
- How to share category taxonomy with custom post type (The Event Calendar plugin)
- Is it possible to define a template for a custom post type within a plugin independent of the active theme?
- How to get a variable number of posts per post type on the main loop?
- Checking if an attribute exists in a shortcode
- WP_query parameters for date range
- Use a plugin to handle custom post types?
- how to include other plugins css files in a shortcode?
- What characters are allowed as a shortcode tag and how should they be sanitized?
- How Do I Use The WordPress Plugin Posts 2 Posts by Scribu?
- All shortcodes not working on custom theme
- enqueue script only if it is not already enqueue
- Shortcode output appears before post body [duplicate]
- Creating a default Custom Post Template that a Theme can override
- Autogenerate wordpress shortcodes using array?
- PHP Deprecated: Non-static method should not be called statically
- How to parse nested shortcodes?
- Loading shortcode with ajax
- Jetpack plugin (ShareDaddy): Prevent share buttons showing on custom post types?
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- Adding Custom Fields for Img in Posts
- How to call shortcode function directly and pass $atts
- Getting Custom Post Type content from main-site of a Multisite
- How To Ignore a Filter On Applying Filter the Content In a Function
- Cannot strip JW Player shortcode?
- Custom database or Custom Post Types?
- Shortcode display outside the div
- How to pass multiple values in shortcode?
- How to make a list of companies’ information and display them to user, using custom post types and a custom taxonomy?
- Custom comment type maybe?
- Register Custom Post Type from Plugin
- Prevent page slug from interfering with custom post type archive permalink?
- append stylesheet via shortcode
- Shortcode under a Shortcode Multiple times Possible?
- Add .html extension to custom post type taxonomies
- How to load a new template page according to a particular URL?
- Twillio How To Send SMS for Custom Post Type
- Pass $this to function nested in another public function of the same class
- change plugin shortcode function [closed]
- Calling function from within functions.php returns unwanted value
- How to get the custom page get_permalink?
- Updating post meta for custom post types
- plugin shortcodes not working on custom theme- unsure how to fix
- How to list all active and specific shortcodes in wordpress
- Seriously stuck with some custom meta box/plugin stuff
- Dynamic HTML not displaying at respective place
- shortcode doesn’t work
- Template for custom post type shows all posts instead of just one
- Themes VS Plugins [duplicate]
- Plugin form unable to process
- remove custom taxonomy metabox form custom post type
- Enable comments for post with comments meta box removed
- Calling shortcode in wp_localize_script strips result
- [Plugin: Posts 2 Posts] reciprocal connections
- Custom Post Type Statuses
- Nested shortcodes
- How to Build a Movie Library in WordPress 3.x
- WordPress shortcodes & performance
- Custom Post Type causes Page Not Found
- How do I get multiple pages by title?
- Is it possible to make shortcodes NOT case sensitive?
- add_meta_box Callback not being called
- Short code for Venues
- do_shortcode() doesn’t work if shortcode contained in variable, works if shortcode passed as string
- I need to add a custom “cover” to every new post — plugin or custom setup?
- Star rating for custom post types [closed]
- How to Make a Custom Grid View
- Layout shop page: resize images and columns
- How to add inline css/js inside a shortcode
- Plugin “Meta Box”: Implementing meta boxes in custom post type
- How extend shortcode default values for a plugin?
- how to show database content in wordpress post
- Get image URL from media library in input
- wp_specialchars and wp_specialchars_decode in a shortcode plugin
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Way to hook into a sidebar call to replace it with a custom sidebar
- Shortcode in AJAX popup
- echo do_shortcode is not working on theme’s template
- Plugin allowing for artists, events and venues
- Disable Other Plugins on my Custom Post Type?
- How to get images from EDD post?
- Looking for a solution – slightly convoluted problem
- Can’t get custom posts of taxonomy to show
- Plugin shortcode won’t work on a custom template file [closed]
- Can I use a Shortcode output as an HTML attribute value?
- WP theme with Backbone
- custom taxonomy and custom post type url conflict
- shortcodes displaying outside of content area with echo statement, not what I wanted [duplicate]