Need Help Creating a Filter for Custom Field
-
I would like to incorporate a custom narration via a custom field. In short, I want the audio file that’s generated to read something different that the content of the page. The use case is for LearnDash; each topic has bullet points but I want the narration to do some explanation. Think like someone is giving a PowerPoint presentation where the bullets are on the screen, but the speaker is adding details and not simply reading the bullets verbatim.
I have a custom field created called narration_text (using ACF Pro), but the only thing I seem to be missing is how to get the post id so get_field works. Below is my sample code; let me know if there is a better way and/or if possible.
function get_narrator_text_callback() { global $post; $narration_text = get_field('narration_text', $post->ID); return $narration_text; } add_filter( 'amazon_polly_content', 'get_narrator_text_callback');
- The topic ‘Need Help Creating a Filter for Custom Field’ is closed to new replies.