Incorporate jquery into WordPress
I am trying to incorporate a very simple audio player into WordPress that uses jQuery to control the player and the player control background image. There will be several instances of the player on a single page.
I have no problem writing the code for an HTML page, but it doesn't work inside a WordPress page. I've been Googling for a couple hours, but haven't found the specific, understandable answer I need, so I apologize if this has been covered elsewhere.
I don't want to write a plugin, I just want to be able to create a little control over the HTML5 audio player.
The script code:
var allAudioEls = $('audio');
var a = $(this).get(0);
var song = $(this).next('audio').get(0);
<img class="gac_play" src="play16.png" />
<source src="audio/fm-sample1.mp3" />
<source src="audio/fm-sample1.ogg" />
Works perfectly on an HTML page, but not in WordPress. Any assistance would be very much appreciated.
They describe their reasoning somewhere in their documentation. The basic intent is to minimize site security risks and avoid the good old days of MySpace...
Your best option would be to implement the same behavior in PHP.
Make sure you're enqueueing the jQuery file properly and to use your ready function as such:
// your code goes here
Or you can use
$=jQuery.noConflict(); in the beginning of the script tag. You can check for other errors in the JS console (Ctrl+Shift+J on chrome).
New wordpress site, want to incorporate an old php catalog
i'm completely new to migrating websites. I made a new website for someone in wordpress but on the same url. I migrated the hosting and changed the A-records. I do have the old site in backup (both files, and sql database.) How would i go about hosting an old catalog that is made in php on a subsite? Kind regards Viktor.
Writing Custom Rewrite Rules that Incorporate Category for Custom Post Types?
I'm registering a Custom Post Type and in the rewrite array I am trying to do something like this: 'rewrite' => array('slug' => "explore/resources/".$CATEGORY, 'with_front' => false) I want the rule to 'dynamically' get the post's category name somehow. I also tried using %category% there but it doesn't work either. I need the post's url t...
Is it possible to incorporate username in a login redirect?
I'm using WP to work as the CMS for a website which will be provided to users of a number of different products. I've successfully created a function which will redirect users based on their role: Some users need to be redirected to a specific page which shares their username. How can I retrieve the username and incorporate it into their redirect? ...
How to incorporate admin theme in my back-end-plugin
I'd like to use some colors from the wordpress admin theme to build my back-end plugin's theme, based on Bootstrap-3 & SASS/LESS. I think I saw a few functions to get the colors of the admin theme but I am not sure its the right way to go. I am aware there might be 3th party admin themes but I'd be already happy to get the standard-themes cover...