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.
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.