Support » Plugin: JW Player for Flash & HTML5 Video » [Plugin: JW Player for WordPress – Flash & HTML5 Video Player] add_shortcode

  • I’m trying to trigger the [jwplayer] shortcode outside the_content, and it’s not working.

    I’m just doing a simple do_shortcode( ‘[jwplayer atts=”foo”]’ ); but upon looking through the code it seems you’re not actually using a shortcode at all ?!?!?

    Is this the case? If so, why? As it is, I’ve been able to accomplish basically the same thing by running jwplayer_tag_callback( ‘[jwplayer atts=”foo”]’ ) but this is fairly awkward and totally NOT WordPress-y of you 🙁

    Just wanted to let you know this caused me some grief and I doubt I’m the only one!

    http://wordpress.org/extend/plugins/jw-player-plugin-for-wordpress/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author JW Player

    (@longtail-video)

    Do you have a link to where this isn’t working?

    Thread Starter cvernon

    (@cvernon)

    No, but just try to get a jwplayer to add <php do_shortcode( ‘[jwplayer]’ ); to any template of any install with the plugin on it. In any situation where a shortcode is registered via the shortcode api add_shortcode() function, this will render the shortcode.

    Your plugin is doing a custom hack regex trick to replace the shortcode in the content instead. This works, but does not allow developers to use the shortcode as a shortcode should be able to be used in WordPress.

    Plugin Author JW Player

    (@longtail-video)

    Interesting that you say that. Can you please provide an example of this?

    hi guys if found a solution here

    the solution:
    echo jwplayer_tag_callback(“[jwplayer config=\”Custom Player\” file=\”$media_url\”]”)

    it workes for me!

    Plugin Author JW Player

    (@longtail-video)

    Thank you for sharing!

    Note: the reason do_shortcode doesn’t work is that LongTail appears to have written their OWN shortcode filter rather than use the WP Core Shortcode API. Hence JW Player doesn’t REALLY use shortcodes as anyone familiar with WP would assume. It re-filters the_content on it’s own looking for it’s bastardized shortcode.

    While this is ugly, I must give them props for giving a reason for it in the comments of JWShortcode.php

    /**
    * @file This file contains the necessary functions for parsing the jwplayer
    * shortcode. Re-implementation of the WordPress functionality was necessary
    * as it did not support ‘.’
    * @param string $the_content
    * @return string
    */
    function jwplayer_tag_excerpt_callback($the_content = “”) {

    I’m not sure what they mean by “did not support ‘.’ “, I’m guessing the normal shortcode regex parser doesn’t allow concatenation of their prefix constant ‘LONGTAIL_KEY’, but I really don’t know. It seems hacky but there was a reason and this is why add_shortcode isn’t used in their code and hence why do_shortcode doesn’t work either:(

    It would be nice if they’d document the use of jwplayer_tag_callback() more clearly so we could use it more easily and reliably.

    I haven’t tried, but I’m guessing one could just call jwplayer_handler() and feed it an $atts array. Which is what I’m going to try and if not fallback to using jwplayer_tag_callback().

    Plugin Author JW Player

    (@longtail-video)

    Jon, thank you for the suggestion and the comment. I will pass this along.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: JW Player for WordPress – Flash & HTML5 Video Player] add_shortcode’ is closed to new replies.