Home › Forums › Add-ons › Repeater Field › How Create Repeater Function › Reply To: How Create Repeater Function
Continuing from your other post:
add_shortcode('showpptime', 'display_presto_content');
function display_presto_content($atts=array, $content='') {
$value = '';
if( have_rows('my_presto_player') ):
while( have_rows('my_presto_player') ) : the_row();
$timestamp = get_sub_field('presto_time');
$optional_text = get_sub_field('presto_topic');
if (!empty($timestamp)) {
// Build the shortcode with the timestamp and optional text
$shortcode = '[pptime time="' . esc_attr($timestamp) . '"]' . esc_html($optional_text) . '[/pptime]';
$value .= do_shortcode($shortcode);
}
return $value;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.