If you want to put the custom fields inside the shortcode…you actually should put the custom fields inside the shortcode. Be sure that your fields content does not get echoed, according to ACFs resources you have to use get_field($field_name)
within the loop. Try:
<?php echo print_wp_cart_button_for_product(get_field('product_name'), get_field('product_price')); ?>
Related Posts:
- Including Custom fields within the_content
- Advanced Custom Forms PHP formatting for do_shortcode
- How to output values from a loop into a javascript array
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Remove from shortcode
- Displaying recent posts on static page with template-part via shortcode
- wordpress 4.4 self hosted video (html5) doesn’t show
- do_shortcode with custom field
- How to Reference/Echo Variable from Another PHP Function
- Remove echo from shortcode
- Replace shortcode in substring
- Sort by page information by Ascending Numbers
- Shortcode to show the code
- Shortcode returns values in the wrong order
- Redirect to another page using contact form 7? [closed]
- Get URL from shortcode tag
- Embedding PHP in shortcode $content
- Shortcode with PHP issue “Undefined index”
- Excecuting php function in shortcode
- Advanced Custom Fields – display label and value only if value entered
- Only first shortcode gets executed
- Advanced Custom Fields not displaying
- Multiple do_shortcode in page template
- Returning data instead of echoing/printing
- echo something inside a shortcode
- displaying content that includes shortcodes within an echo
- List taxonomy term slugs within shortcode (do_shortcode)
- Shortcode from a function not working
- Display Data in Table from External Database in WP using Shortcodes
- Download PDF after CF7 form submission
- get_posts works in the page template but not in a shortcode
- Is it possible to return content, and then also continue to do other things?
- ::before on open/close function [closed]
- anyway to put inside a $outprint=sprintf()
- Is There A Way To Make Theme Files Accept Shortcodes?
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- How can I include shortcodes within PHP?
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- Create a WordPress shortcode using PHP [duplicate]
- do_action(), iFrame Gets Displayed Despite Password Protection [closed]
- $wpdb returns duplicate posts
- Creating WordPress Shortcode with Variable
- Catchable fatal error: Object of class stdClass could not be converted to string
- Syntax error in a shortcode function
- Using Shortcode to Grab Archive Listing, Separate by Year
- Capitalize Shortcode Value on Output
- Shortcode to find and replace URL
- Why is my str_replace not working on short code submitted by front-end?
- Could use some help with Shortcodes
- How to put a form with php code into a variable or shortcode?
- Unable to process php via shortcode
- Help with WordPress function inside a shortcode
- Upload non-featured image to image field
- calling a custom field value inside functions.php
- Using ob_start and ob_get_clean with wordpress shortcode
- HTML Special Characters in URL string [closed]
- ACF put a comma after the last repeater field value [closed]
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- Short code template + ajax
- WordPress shortcode returns the data before
- List all blogs, but exclude the main site
- Shortcode to embed Edit Account form not working
- Form search query – displaying ACF “Post Object” field as results
- InnerBlocks with allowedBlocks not working with acf_register_block
- Shortcode not staying inside div tag
- Line breaks inside shortcode variable
- Accessing values from ACF sub field (flexible content area) in PHP
- Creating an image from a custom field
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Get ACF options field in PHP acting as CSS
- ACF & Bootstrap Gallery Shows Blank Slides [closed]
- Handling PHP/HTML inside the output of a shortcode function
- Shortcode for Listing Users from Meta Value?
- Conditional multidimensional arrays and array_map
- ACF Repeater Pagination stopped working since upgrade to php7.2
- How can I count ACF sub_field with a certain value
- Cant display an image via PHP in wordpress
- Shortcode to pull posts
- what is the method to echo class attribute inside the i tag? [closed]
- PHP code inside Shortcode
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- Help Fallback (thumbnail)
- Refactoring long if/else php chains
- Getting taxonomy category Image from ACF [closed]
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Shortcode to log user into current URL
- Shortcode function doesnt work without caption
- Action Hook Inside WordPress Plugin Shortcode
- How can I include the user id inside of a shortcode php output?
- Split shortcodes to array of shortcodes
- Shortcodes showing in excerpt despite using strip_shortcodes
- PHP error with a shortcode: “no suitable wrapper” for file_get_contents
- PHP Helper Class to create shortcodes
- Show get_sub_field value if it exists [closed]
- Update post meta – Custom field does not match meta-key
- Calling PHP Titles inside Javascript Markup
- Advanced Custom Fields [closed]
- How to make a conditional statement within $output in shortcodes.php?
- help with custom shortcode that stopped working