Try this:
<?php
function howitworks() {
$page = get_page_by_title('shop');
$html="";
if (have_rows('steps', $page->ID)) :
$html .= '<div class="test">';
while (have_rows('steps', $page->ID)) : the_row();
$image = get_sub_field('icon');
$html .= '<div class="col">
<img src="'.$image['sizes']['thumbnail'].'" alt="'.$image['alt'].'" title="'.$image['alt'].'" />
<h2>'.get_sub_field('step').'</h2>
<p>'.get_sub_field('description').'</p>
</div>';
endwhile;
$html .= '</div>';
endif;
return $html;
}
add_shortcode('howitworks', 'howitworks');
?>
EDIT: I change up my code for replace the_sub_field by get_sub_field
Related Posts:
- Using ACF field in do_shortcode()
- possibility to control embedded video timeline with buttons and links external to the player
- Problem with using custom shortcode with ACF WYSIWYG field
- Can I wrap an unordered list inside a shortcode?
- Create shortcode in WordPress, using one variable in 3 functions?
- Shortcode default attributes over-riding non-default attributes
- Image Shortcode from ACF ID
- Basic do shortcodes question
- How to Generate html tags using shortcodes?
- Pass fileurl parameter into shortcode from Advanced Custom Fields
- Custom Shortcode + Querying and Ordering Posts using multiple Advanced Custom checkboxes
- Ordering get_terms with ACF not displaying all terms
- Adding a custom field to do_shortcode [closed]
- Shortcode strips formatting and returns at content top
- ACF repeater + group shortcode
- Need help in setting up a transient using API Key and if possible updating it in the ACF field
- Shortcode custom query not passing value
- Use ACF array values in shortcode
- how to add acf value to other plugins shortcode?
- How do I use “while” and “end while” inside of the echo do_shortcode with ACF Repeater?
- How can I hide the ACF shortcode when empty
- Custom shortcode being executed when saving page in wp-admin
- Change appearance of shortcode text inside editor
- Shortcode outputs at the top of the_content
- How can I just get content inside a shortcode or just outside
- WordPress core responsive video not working with shortcode
- WordPress gallery ‘post_gallery’ filter doesn’t work with feeds?
- Ajax not returning anything on form submit
- Simple contact form with field validation
- Slow page loading when using a simple shortcode on the same page multiple times
- Remove and restore one shortcode
- Using do_shortcode with variables?
- Display content from another site page using a shortcode
- Remove hyperlink on gallery shortcode
- Instagram URL is converted into oEmbed
- Shortcode with no attribute but has value
- Remove wpautop from specific shortcodes only
- Combining similar shortcode functions?
- Shortcode adding plugin output before post, instead of inline [duplicate]
- How to build a shortcode which can insert a query string into a DB table
- What is the Correct way to pass parameters in function
- Shortcode – Getting Categories appears on top of website
- Visual Composer integration [closed]
- How to Modify WordPress Default Image Gallery Shortcode
- Passing html tags as shortcode parameters
- Button Shortcode
- Shortcodes in excerpts returning empty string
- Placing tags on wordpress visual editor using shortcodes
- Using Variables in Shortcodes
- Default Attributes in Shortcode Not Working
- Replacement for gallery_shortcode function not taking all attributes
- Shortcode syntax errors
- how can i pass this attribute in this shortcode?
- How to add a same div on every page
- Display a form partially with a shortcode
- Modifying the wordpress login page and then referencing it with a shortcode problem
- How to make shortcode which returns HTML?
- Render shortcodes with get_post_custom
- How to create a custom shortcode for custom login form?
- Enclosing Shortcode not working in a Template
- Set redirect for need login
- make user_id in a shortcode dynamic based on who’s logged in
- How to show Custom Post Type – Case Study using Shortcode & ACF
- pass complex json as shortcode parameter
- Image Caption Shortcode Broken upon update
- Shortcode not working in CPT taxonomy
- wp_enqueue_scripts does not work on admin page
- shortcode containing other shortcodes not returning content
- How to embeded shortcode for another website
- To know whether insert shortcode in custom meta box
- Shortcodes not working in custom page
- Get label in user meta query
- Shortcode not being executed
- Using within a shortcode
- Shortcode not working when I output data from wpdb html table row
- How do I point bloginfo(‘stylesheet_directory’) to my parent theme?
- Add audio file to post using custom term meta field as link [closed]
- How to list child pages with excerpts, e.g. [child-pages depth=”1″ excerpt=”1″]
- Add a shortcode in woo-function.php
- Get current category and place it in shortcode
- Woocommerce products shortcode specific order
- Modify Blog Module layout in Child theme
- Video shortcode outside WordPress not working with IE and mediaelement’s Flash fallback
- Display title of child pages in shortcode
- Output html source tags inside shortcode
- How can I define the output of shortcode attribute value?
- What is the best way to include a template file within a shortcode?
- Shortcode templates
- Create plugin/function to catch XML-data via Shortcode
- Why My slider shortcode display above header
- Does anyone recognize shortcode ig_special_heading?
- How to scroll to a shortcode-generated anchor
- add post type pram to wp shortcode
- Shortcode conversion to hrml when post is published
- Shotcode error on functions
- Shortcode for displaying the user’s first name?
- Can I prevent wordpress adding and tags to autoembeds
- Shortcode – Display inline icon before text [closed]
- Why does my shortcode query not working with search term
- How to use multiple values in “Shortcode”? [closed]