Home › Forums › Front-end Issues › Issue with Displaying Custom Shortcode › Reply To: Issue with Displaying Custom Shortcode
Your shortcode is just running shortcodes and not producing anything.
First your loop should be inside of your shortcode function.
Second you need to return the html
this is just a guess, but hopefully you get the idea.
function display_presto_content($content) {
ob_start();
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)) {
$shortcode_content = '[pptime time="' . esc_attr($timestamp) . '"]' . esc_html($optional_text) . '[/pptime]';
display_presto_content($shortcode_content);
}
endwhile;
return ob_get_clean();
}
add_shortcode('showpptime', 'display_presto_content');
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.