Edit plugin to load Caption by default
-
Please help – the Audio Igniter plugin also has a “lyrics” field so you can add the lyrics and it comes up on the front end with the song. Because I’m adding the same audio files to several different playlists, I don’t want to add the lyrics each time. So I wanted to add the lyrics text to the “Captions” field in the WP media library, and then make Audio Igniter map that field to the “lyrics” field just the way that it maps the Title and Artist.
How can I do this?
In the plugin files, the /assets/js/audioigniter.js files has the below code that looks as if it’s responsible for loading the track metadata. I’ve tried editing it to include the Captions field but I’m not proficient in jQuery and I broke the plugin.
/**
* Populates a track field
*
* @param {Object} $field – The field’s jQuery object
* @param {Object} media – WP Media Manager media object
*/
function populateTrackField($field, media) {
var $urlInput = $field.find(el.trackUrlClassName);
var $titleInput = $field.find(el.trackTitleClassName);
var $artistInput = $field.find(el.trackArtistClassName);
var $fieldTitle = $field.find(el.fieldTitleClassName);if (media.url) {
$urlInput.val(media.url);
}if (media.title && $titleInput.val() === “”) {
$titleInput.val(media.title);
$fieldTitle.text(media.title);
}if (media.meta && media.meta.artist && $artistInput.val() === “”) {
$artistInput.val(media.meta.artist);
}
}
- The topic ‘Edit plugin to load Caption by default’ is closed to new replies.