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)
- Shortcode to insert
- Shortcode putting html such as
- Using Echo in ShortCode – Stuck
- Multiple do_shortcode($content) within one shortcode
- Adding Image Count to Multigallery
- My shortcode is showing up twice
- WordPress menu deletes when trying to add a hook
- Advanced Custom Fields Image Field returning ID instead of URL [closed]
- How to find the output of contact form 7 shortcode? [closed]
- How do i get (unique) page name?
- Can an array be used as a meta_query value?
- Can A Shortcode Get HTML/Text From Content And Return It Twice With Added HTML?
- Browser title script ignoring is_page /else conditional [closed]
- Nested shortCode functions in the functions.php file
- Making Quote Plugin more efficient
- How to limit the content coming from wordpress shortcodes?
- ACF check if variable has http, if else return string
- How can I get content inside one shortcode to another shortcode?
- Create shortcodes within foreach loop (using array)
- ACF page while loop breaks footer while loop
- ACF: how do I get the fields and its values of a specific group?
- How to exclude category ID from Looper in WordPress
- Add a specific part of current category page url to shortcode
- How to display data from custom table in wordpress phpmyadmin
- Calculating a large number of MYSQL queries as customshort codes, slow
- Output ACF repeater on frontend user’s profile page (created with Ultimate Member) [closed]
- Remove the first 5 characters of the_title and orderby that
- How can I dynamically update the class in my shortcode?
- Creating own shortcode – echoeing php variable based on JS variable
- How create a Shortcode with hover and complex options
- Remove from shortcode
- How to Reference/Echo Variable from Another PHP Function
- Only first shortcode gets executed
- echo something inside a shortcode
- Display Data in Table from External Database in WP using Shortcodes
- anyway to put inside a $outprint=sprintf()
- Capitalize Shortcode Value on Output
- Why is my str_replace not working on short code submitted by front-end?
- Shortcode not staying inside div tag
- Line breaks inside shortcode variable
- Shortcode for Listing Users from Meta Value?
- Shortcode to log user into current URL
- Shortcode function doesnt work without caption
- Calling PHP Titles inside Javascript Markup
- Create special button on WP Tiny MCE Posts Editor for Shortcodes
- What is the difference between Null vs Empty (Zero Length) string?
- Update user repeater meta (ACF) with another user meta field value
- Show Featured Image Dimensions and size frontend with shortcode
- How to work Woocommerce pagination inside shortcode?
- Payment field disappears on custom Paypal plugin
- Display logged in user name and lastname on page
- Display Visual Composer shortcode if a post belongs in specific categories
- is it possible for a URL to filter by tag
- Trying to create a shortcode to display categories with a specific product tag
- How to pass parameters in wordpress shortcode?
- ACF Taxonomy field values not select in backend
- Replace background image with post thumbnail in shortcode
- How can I prevent a shortcode div from extending beyond its boundaries?
- Conditional formatting on data fetched from MYSQL
- Use WPQuery to match to specific repeater row in post
- Adding variable in WordPress shortcode
- Display a custom name when the user has no name settle in his account
- ACF – Can’t get custom post type by taxonomy
- Advance custom fields variable with if statement & Function
- ElseIf Statement with ACF Group field
- Execute Shortcode in Textfile
- custom taxonomies not working
- Place product field value as variable in php
- ACF – Get ID of relationship field in flexible content
- Display current user metadata on WordPress page
- Pulling Products from an API
- Shortcode’s output to use as other shortcode’s parameter
- Scheduling a post using publish date from a custom field. Resulting post is set as published in the future instead of scheduled
- Ordering / grouping posts by datepicker ACF
- Short code into PHP
- Add two or multiple functions in WordPress Post or Page
- Shortcode Works for Logged in Users but Not Working for Guest
- perform mathematical operation on shortcode
- ACF Images If/else
- problem multisite with blog id
- Page returning ID from array, how to return the correct values for post in acf wordpress
- Shortcode At top of Page – PHP 5.5 vs 5.4 – ob_start();
- Shortcode Display From WordPress Dashboard Page Without Using post_id
- Do_shortcode on PHP file outside theme ALMOST works
- Using the same shortcode to show any table from the database
- Shortcoding with Divs
- Custom Shortcode with Dynamic Button
- Add comma between variables [closed]
- Whats wrong with my code? Need To add String to shortcode? [closed]
- ACF | WooCommerce | Theme Development | How to include a /template-part/ that makes use of ACF’s on a custom WooCommerce homepage?
- Shortcode for Visual Composer Grid fails turning string to integer
- Gutenberg – render_callback does not pass ToggleControl value on frontend
- HTTP 500 Error after Creating Shortcode
- Show button in header when product custom field is not empty
- How call WordPress shortcode inside function file
- How to execute a shortcode within a custom field?