Support » Plugin: JW Player for Flash & HTML5 Video » [Plugin: JW Player Plugin for WordPress] Insert JW Player plugin into a widget

  • Resolved richiesun


    Racking my brain here. Downloaded and installed shortcodes in widgets plugin. I checked another plugin to see if it works and it did, but for some reason, JW’s shortcode does not work. All I want to do is insert the JW plugin into a widget and wordpress doesn’t recognize. It echos plain text in that sidebar instead of a player.

    What gives? I’ve test the JW shortcode in short and long formats to no avail. Please help.

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


    Hi richiesun,

    I would have expected this to work as well. The only thing I can think of is that I had to (unfortunately) re-implement the WordPress shortcode system as my own filter. The reason for this was the fact that WordPress shortcodes don’t support periods (.) which are necessary for JW Player plugin flashvars. We’re planning an update to the plugin soon and I’ll take a look at the possibility of adding widget support.

    In the meantime I think you can add a filter to your widget and call my shortcode method.

    So something like this:

    if (!is_admin())
      add_filter('widget_text', 'jwplayer_tag_callback', 11);

    You will likely need to include my JWShortcode.php file as well.

    Hope that helps.

    Thanks Longtail, I’ll give it a whirl and let you know how it works out.

    All I did was open jwplayermodule.php and added
    add_filter(“widget_text”, “jwplayer_tag_callback”, 11); under where it says
    add_filter(“the_content”, “jwplayer_tag_callback”, 11);.

    Not sure of if this the correct way to do it, but it works. Thanks for the help.

    Plugin Author JW Player


    Hi richiesun,

    Glad to hear it’s working for you. I’m currently working on an update for the plugin and I’ll likely add that in as part of it. I’ll do some testing as well to make sure it’s the correct solution.

    Have fun with the plugin!

    I’ll be glad to see that update 🙂 I’m also looking for to use the plugin in a widget.



    I believe I have the latest version of this, which has the following line already added:

    add_filter('widget_text', 'jwplayer_tag_callback', 11);

    and I’m still having the same initial issue — the code is echoing the string as text, not as a video. Here’s how I’m trying directly inserting the code into my template file:

    `<?php echo do_shortcode(‘[jwplayer config=”nater_video” file=”http://localhost/110115-1/wp-content/uploads/2011/06/felix-content.flv” image=”http://localhost/110115-1/wp-content/uploads/2011/06/felixpic.jpg”]’); ?>’

    do you have any thoughts on what I may be doing wrong? also @LongTailVideo what exactly do you mean about posting that line of shortcode in ‘my JWShortcode.php? Is there another file I’m missing?

    Plugin Author JW Player



    With the latest version of the plugin you shouldn’t need to add any code to the plugin in order to get it work within widgets. You just need to put the shortcode in the body of the widget and it should work correctly.

    What problem are you having exactly?


Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: JW Player Plugin for WordPress] Insert JW Player plugin into a widget’ is closed to new replies.