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]
- Implementing a CrunchBase.com Clone using WordPress?
- How to customise the output of the WP image gallery shortcode from a plugin?
- 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?
- WP_query parameters for date range
- Use a plugin to handle custom post types?
- All shortcodes not working on custom theme
- enqueue script only if it is not already enqueue
- How to parse nested shortcodes?
- Register Custom Post Type from Plugin
- change plugin shortcode function [closed]
- Updating post meta for custom post types
- Dynamic HTML not displaying at respective place
- Plugin form unable to process
- Short code for Venues
- Shortcode doesn’t work if I directly paste its function in a template file?
- Override plugin with functions.php
- Pass variable to nested shortcode
- Add custom variable in Contact Form 7 mail body
- How to generate CSS from a shortcode within a plugin
- Storing Options in a Shortcode
- How does WP handle multiple matching rewrite rules?
- Prevent shortcode from being wrapped in tags
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- Plugin Handle URL With Custom Theme
- more types plugin – display all post of post type on page
- AddToAny shortcode in the loop
- How to fix wrong attribute error for Visual Composer Grid Builder?
- auto populate list of questions if user select a category xyz
- Shortcode Plugin to dynamically build a shortcode via `do_shortcode` not working
- Shortcode for CPT post content in a page
- Creating shortcodes in plugin
- “Custom Post Type Permalinks” plugin URL strcuture
- Inject HTML meta tag inside wordpress tag using add_shortcode
- Custom Post Type Fields
- Custom setup of wordpress comments that are displayed
- My plugin won’t return anything [closed]
- publish_post action doesn’t work
- Disable Individual Plugins (specifically in Custom Post Types) on a per-post basis?
- Shortcode to update user meta
- custom post type don’t appear in the home page
- Why shortcode always displayed after footer not in body
- Why am I unable to load scripts in head in plugin?
- Deactivate JS Script in Plugin Shortcode
- Shortcode not working after move wordpress website files
- Plugin that provides the [edit] shortcode?
- Return multiple values in a shortcode attribute
- How to change shortcode’s default theme?
- Override/ignore CSS from active theme as not to interfere with my custom CSS
- How do we update a custom file upload field with the Advanced Custom Field plugin?
- Is there a way to convert shortcodes to html content?
- Loop returns the current page’s permalink and guid instead of the post in the loop
- Custom Template for wordpress cpt plugin
- Shortcode and variable
- How can I achieve this, using shortcodes
- Elementor Pro display featured image on section -> style -> image using shortcode
- Rename existing cpt and taxonomy with new textdomain
- How to search post titles with whole words only, but not the exact word only?
- Remove custom taxonomy name from the slug – Custom Post Type UI
- Can i stream data to a custom_post_type?
- Is there a hook similar to “save_post” which only fires AFTER the post is completely published?
- save_post hook partly firing in update post
- Shortcode show error while editing post
- Get Shortcode output to database for static post_content
- Cannot view Custom Post Type no matter what I try
- Issue Saving Posts That Contain Shortcode
- Using Shortcode Result In Custom HTML Block (Using Google Sheet JQuery Result As NumScroller data-max)
- Page not found after creating the add new post slider using custom post type
- How to use plugin’s shortcode in custom design? [closed]
- WP Plugin CSS not being applied to page
- Multiple calling javascript from shortcode in one page
- Enable shortcodes on custom post type
- How to pass value to a plugins shortcode?
- Find all strings between an enclosing shortcode
- Hide some shortcodes on posts from back-end
- Trouble implementing python on WordPress
- Is there a function to search for a wildcard value when calling a shortcode?
- Plugin Error on activating
- How to display single arbitrary facebook post with a shortcode?
- Multiple level shortcodes
- How to load a plugin when doing an Ajax call? [duplicate]
- Is it right way to create shortcode?
- Trying to override/intercept a PhotoMosaic gallery link in WordPress using jQuery
- Insert data in custom table during new post creation
- Top Contributors Plugin with Custom Post Type
- How can i do custom author list?
- featured image problem with custom post type
- Is an Office a custom post type [closed]
- Creating Features List in WordPress Post
- How to Create Short Code Using Custom Post type
- Snippet displaying LearnDash parent course title with lesson title [closed]
- I am experiencing difficulty fulfilling client request
- Shortcode to do math with url variables
- How to get URL param for pagination in shortcode?
- Buffered output in chunks and shortcode – how do I achieve that?
- How to provide page_template path in custom plugin using WordPress