Home Forums Front-end Issues Issue with Displaying Custom Shortcode Reply To: Issue with Displaying Custom Shortcode

  • Hi John,

    Thank you so much for helping me with this. I’m very new to ACF & obviously not that strong at writing functions.

    I tried your suggestion adding the shortcode [showpptime] to a post, but doesn’t show the fields output, it just displays [showpptime]
    It should be displaying the “optional text” as a link to a timestamp in a Presto Player video.

    The original shortcode I am trying to use as a repeater is:
    [pptime time=”1:08″]Optional Text[/pptime]

    “pptime time” being the field “presto_time” and “Optional Text” being the field “presto_topic”.

    The developer of the Prestom Player sent me the following to use:

    $timestamp = get_field('timestamp_field');
    $optional_text = get_field('optional_text_field');
    // Use do_shortcode to display the content
    echo do_shortcode('[pptime time="' . esc_attr($timestamp) . '"]' . esc_html($optional_text) . '[/pptime]');

    “This code retrieves the values from the ACF fields and processes them through do_shortcode, creating the desired output.”

    Big thanks in advance for any help you can offer.