Add this code to your functions.php file and then you can use [product_title id="123"]
shortcode
If you want other product meta you can edit the function to return any product data you would want
/**
* Product title shortcode.
* `[product_title id="123"]` to get a specific product title, by ID
*
* @return string The post's title.
*/
add_shortcode( 'product_title', function( $atts ) {
$atts = shortcode_atts( array(
'id' => get_the_ID(),
), $atts, 'post_title' );
return get_the_title( absint( $atts['id'] ) );
});
Related Posts:
- php dynamic content inside shortcode
- How to show Custom Post Type – Case Study using Shortcode & ACF
- Custom Post type to Woocommerce Product type
- Alike Shortcode using in Custom Shortcode
- Show in an entry a Custom Post Type associated to a post
- How to display related posts using the same taxonomy for custom types (WordPress, Pods, Woo)
- Create a CPT to edit Shortcodes Atts
- Can’t Export Custom Post Types With Export Tool In A Custom Theme
- Display CPT Category List as Shortcode
- Can Someone help me to create Short Code for displaying a category posts
- Shortcode with loop stacks output
- How to display custom field in product description?
- Custom post type shortcode
- background featured image display using shortcode
- Add two custom product type
- Duplicate the “Orders” list on Admin Page
- How to display the post using a shortcode in WordPress?
- How can I use javascript in specific posts without relying on a plugin?
- What’s the best way to do this: inquiry/ticket system?
- Sudden 404 pages on product category archives
- How to return/export only data showing on screen in custom post type view all screen
- ‘Simple’ Reservation System
- How to generate auto shortcode for custom post type same as Elementor Template?
- Change display of product price on product show page only
- Why can’t I filter my CPT shortcode by category?
- From CPT Custom Loop into Shortcode?
- editing shortcode for custom post type within a plugin
- Button link display in shortcodes using custom field in ACF
- Custom Post type shortcodes
- Custom post type shortcode with taxonomy attribute not working and no errors
- Shortcode and get_template_part
- edit.php all post not working
- How to show link to product in custom fields?
- WordPress post not executing shortcode until updated
- Display Custom Post Type Archive content with Shortcode
- Exporting Post type from one theme and importing it to another theme
- Exporting CPT from dev site and import into live site?
- Load custom post type with ID in a shortcode
- add action save post type and update post meta woocommerce
- WooCommerce – Custom related product (Spareparts)
- Convert attribute woocommerce terms (taxonomy terms) in posts of custom post type
- How to seperate posts by categories?
- WooCommerce change
- Display a list of sub-pages of Custom Post Type Parent Page
- Do not parse shortcode in CPT
- WooThemes – Vendors / Bookings – Allow Vendors to manage resources
- Search in multiple specific post types
- woocommerce post_type conflict with existing post type
- Shortcode in excerpt
- Custom Taxonomy not working front side Woocommerce
- WooCommerce breadcrumb display custom posts instead of product data
- Extracting Post ID and passing through as an attribute in a shortcode
- Enable shortcodes on custom post type
- Custom meta box in editor of custom post type not working
- Custom Taxonomy is disabled on Edit page
- CPT or Custom Table for Repository of Serial Numbers
- Get Non-Paginated Index of Post in Paginated Query
- Complex strcuture as CPT or taxonomy for use in woocommerce product variations [closed]
- Plugin Error on activating
- Ads below footer
- Shortcode error
- Modify shortcode to work with custom taxonomies and slugs
- Custom Info Box at end of posts?
- shortcode order for event custom post type
- Shortcodes in custom post fields without the_content()
- Shortcode display CPT Query only showing 1 post?
- Custom Search Template for Custom Post Types
- Custom Post Type vs Shortcode: Which one is more performant?
- How to call Shortcode categories for custom post types?
- Using get_terms() as shortcode attribute
- adding a shortcode into a custom post type
- Nested loop called with shortcode duplicating the content above the main loop
- Add number in increment of one to DIV ID
- shortcode for recent custom type post
- Create shortcode for list of custom post titles with custom fields alongside
- Creating shortcodes with user created forms
- Navigation links to posts in current term shortcode
- WP_Query wooCommerce category
- WooCommerce – Complete Order when an action occurs
- How to Create Short Code Using Custom Post type
- Adding custom shortcode to page leads to page without styling
- Issue On Listing Woocommerce Parent Tag List
- Shortcode in a page to display custom posts which also have a shortcode in them
- How to loop through a custom post type using a shortcode and output each element in the loop using shortcodes
- Passing postid of Testimonial Custom Post in Shortcode Parameter
- Create a WordPress Database query to find users who purchased specific product through WooCommerce [closed]
- Display page and custom post title inside shortcode
- trying to display custom post type with custom taxonomy value by shortcode can’t works [closed]
- cannot export data from CPT UI (books)
- How to separate posts by categories?
- Problem with shortcode
- strange issue with get_post_type() when using it in a shortcode in text widget
- select categories by ids/display terms only selected
- Custom Field in Page Title
- SOLVED: Shortcode to display Divi project filtered by tag in WP Query loop
- Pre defined checkbox / radio button state based on value stored in ACF fields in checkout form WooCommerce
- I am having a problem with fetching product data in the Gutenberg block editor
- Add Shortcode functionality to a function that queries custom post type / taxonomy
- WordPress display post count for custom post type
- Display the progress of post achievement with percentage against target in wordpress dashboard