Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m not sure what a “body scripts” section is, but a script block somewhere in a page’s body element should do the job. The problem is placing script in page content makes it vulnerable to corruption by things like wpautop(). To get around that problem, make a custom shortcode that returns the script block you need.

    A generic shortcode example is here. It can be placed in your theme’s functions.php, or better yet, that of a child theme.

    If your shortcode will not use attributes or content, you don’t need the bulk of the example code within wporg_shortcode(). Just assign the script block you need to $o as a string literal. Then do return $o; as shown. Add the shortcode [wporg] or whatever you name it to the page content where the video player in embedded. Anywhere in content is fine.

    Your script example assumes that jQuery is already loaded on the page. If it’s not, you’ll also need to enqueue jQuery.

Viewing 1 replies (of 1 total)

The topic ‘Coding audio player for google chrome users’ is closed to new replies.