• I prefer to use a downloaded audio plugin (Compact Audio Plugin) instead of the default. When I upload mp3 files using the add-media button, a shortcode is automatically installed: [audio mp3=something][/audio]. It would be nice if I could find a way to intercept and write this to the format of my prefered plugin.

    Here is a list of the dead ends I have pursued:

    The function add_shortcode ($tag, $arg ) will only change the attributes. Similarly the shortcode_atts_{$shortcode} filter only changes the attributes.

    The wp_embed_handler_audio filter seems like a good fit, but it never gets called. I can not find any invocation of the function the applies this filter.

    For a while I thought $shortcode_tags might be helpful, but it seems to be only a list of possible shortcodes rather that actual.

    Also, I found lots of threads about how the 3.6 audio player has caused problems for lots of existing wp installations.

    My last option would be a brute force regex in a filter of the the_content, but that seems to extreme.

    Anyway, I would greatly appreciate some suggestions

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter mirgcire

    (@mirgcire)

    At the risk of reducing my chances of a reply, I feel the need to update this with my latest findings.

    This action, of inserting text into the document being edited, has to use a javascript of some kind. Following this assumption, I traced the possibilities down to wp-includes/js/media-views.min.js where a mega javascript resides. Even if I knew a little javascript, the fact that this script has just one line with 56876 characters makes it pretty much impenetrable.

    Unless someone has can make a suggestion, I’m giving up on this strategy.

    Moderator bcworkz

    (@bcworkz)

    Yes, that is a minified version not intended for humans. The non “min” file version (media-views.js) is human readable and effectively the same thing.

    I can’t help with your actual problem, but at least you can examine javascript that is intended for humans.

    Thread Starter mirgcire

    (@mirgcire)

    It turns out that the best (and possibly only) solution is to filter the_content and replace all audio shortcodes with the preferred alternative. This is a nice solution because if the preferred alternative changes There is only one place that needs to be updated.

    @bcworkz: Thanks for the info. media-views.js is much easier to read, but still not much easier to understand.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How make add-media insert an alternate audio shortcode?’ is closed to new replies.