I ultimately figured out getting a shortcode to work by reworking the code to the following:
add_shortcode( 'gr_shortcode', 'gr_shortcode' );
function gr_shortcode() {
$buffer="<h3>Upcoming Titles</h3>";
$q = new WP_Query(array(
'post_type' => 'game_release',
'posts_per_page' => 3
));
while ($q->have_posts()) {
$q->the_post();
$buffer = $buffer.get_the_title().'<br>'.$buffer.the_field('release_date');
}
wp_reset_postdata();
return $buffer;
}
Related Posts:
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- How to render a custom post type template with custom fields using shortcode
- How to show Custom Post Type – Case Study using Shortcode & ACF
- Show in an entry a Custom Post Type associated to a post
- Button link display in shortcodes using custom field in ACF
- Extracting Post ID and passing through as an attribute in a shortcode
- Media library – Limit images to custom post type
- WordPress Custom Shortcode Conflicting with Media Library
- Query by 2 values of a repeater ACF field
- Using shortcodes to parse POST request (containing the data from a front-end form)
- Show ACF field from custom taxonomy and display on the single template
- Get Custom Field Values by Another Custom Field in WordPress
- Show custom field from custom taxanomy term on custom post type
- How to create an array for a CPT post ID to use in an IF/WHILE statement
- Custom Post type with ACF in REST API, how do I get those values?
- Shortcode doesn’t display in custom post type
- Create 3 Level Relations with ACF and WordPress
- Add category attribute to custom shortcode
- How to: Display ACF [fields] on Custom Post Types Utilising WordPress ‘Hooks’? [closed]
- Shortcode for display posts in wp-editor
- Display Recently Added Custom Post Types with Custom Taxonomy Shortcode
- WP_Query to select custom post type with Advanced Custom Fields (ACF) date
- Bulk Update Custom Fields for Custom Post Types
- ACF Values Don’t Show After Import Unless I Edit/Update Post
- Stuck in Order by more then one
- Query Custom Post Type Taxonomy term with multiple parameters
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Integrate Custom Post Type Events into Calendar
- WebP Fallback for Inline Background Image in Style Attribute
- Query based on custom fields start and end date
- Redirect to another page using contact form 7? [closed]
- Can a shortcode included in post content add styles to the ?
- Why is my WP Query not returning first result’s post meta?
- Checking if looped item has a parent inside a shortcode
- Recoverable Fatal Error – Object of class WP_Post could not be converted to string
- get_post_meta is not working inside shortcode
- set_query_params using custom params defined in functions file?
- How to define the template for custom posts?
- Run shortcode in custom script in wp_head if post type is CPT ‘Jobs’
- Query entries from custom post type in an ACF flexible content field
- Shortcode is displaying the content on top of the page [duplicate]
- Distribute Custom Post in different pages
- How do I replace the post title with a custom field?
- posts within custom post type all share the same content in the front-end
- Change post type depending on shortcode
- Custom Post Type with Configurable Sidebar via ACF
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- Looking to Customize YouTube Video Embeds
- Custom Sidebar in Editor (not Widget) for Custom Post Type in Genesis
- Custom field with Types: get custom field’s value label (of type select)
- display custom portfolio tags
- Get Posts List of Current Selected Custom Taxonomy in Shortcode
- php dynamic content inside shortcode
- Create if else for post types in WP_Query ‘post__in’ values
- Using ACF values in nested WP queries for CPT with date values in the past
- Create/populate Custom Posts ACF fields from external JSON file
- WordPress URL rewrites using Advanced Custom Field
- Custom Post Type and Structure Question
- CPT email notification including only new value custom fields
- How can I use javascript in specific posts without relying on a plugin?
- Display Custom Field or Custom Taxonomy in front page /post/product
- Why do my custom post types stop displaying over time?
- How to access repeater field of a custom field?
- ACF Pro Accessing fields on a Custom Post Type
- Modify Publish Metabox location on CPT
- Some posts not displaying by taxonomy term
- Save_post acf data not updating category of post type
- Display Specific Posts at Start of Loop
- How to display custom post type pagination buttons when processing AJAX request
- How to seperate posts by categories?
- Display custom tax in “while” loop
- CPT: execute code after load if parameter is set
- Shortcode in excerpt
- ACF Post Content Not Being Searched
- Group/list/sort custom post type posts by date in tabs from acf datepicker field
- Custom post tag images not displaying with ACF
- Custom Post Type vs Shortcode: Which one is more performant?
- Get post id of permalink for a specific custom post type?
- If you’re calling a dynamic css inline style does that div have to be in the loop?
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- Copying custom field value in to title
- Create shortcode for list of custom post titles with custom fields alongside
- How to show animal lineage/pedigree in WordPress?
- Custom Post Type Loop breaking php
- Styling first post using Advanced Custom Fields
- Adding custom shortcode to page leads to page without styling
- ACF Relationship: Group posts by parent category term, then child [closed]
- ACF Field to set Publish Date – Post Duplication upon Update
- Getting ACF relationship field information
- Shortcode in a page to display custom posts which also have a shortcode in them
- Passing postid of Testimonial Custom Post in Shortcode Parameter
- How to I add count of custom posts listed in a post as a prefix to its title
- Filter page ID outside the loop and order
- Custom taxonomy meta fields
- Create WP multisites as a custom post type
- WordPress WP_Query Sort by 2 dates – custom fields
- Problem with shortcode
- Custom Sort Order for Custom Post Type Taxonomy
- WordPress post objects in one parent post object