Allows to display Advanced Custom Fields Pro Repeaters whitout a plugin or page builder that allow ACF fields.
How to Setup Snippet
To display this repeater in Elementor, use the shortcode widget, and enter:
[show-required]
It can also be used anywhere else shortcodes are allowed.
'show-required' = shortcode name
'required_posting' = id of repeater
'section_title' = id of fieldname inside repeater
It can also be used anywhere else shortcodes are allowed. ‘show-required’ = shortcode name ‘required_posting’ = id of repeater ‘section_title’ = id of fieldname inside repeater (Code is not mine, I found it but there was no author mentioned)
/* shortcode for displaying required posting repeater field from ACF*/
add_shortcode ('show-required', 'dnlt_show_required');
function dnlt_show_required() {
$pageID = get_the_ID(); // not required if within loop, but doesn't hurt
$content= '';
if( have_rows('required_posting', $pageID) ) {
$content .= '<ul>';
while( have_rows('required_posting', $pageID) ) {
the_row();
$content .= '<li>' . get_sub_field('section_title') . '</li>';
}
$content .= '</ul>';
}
return $content;
}