WordPress.org

Ready to get started?Download WordPress

Forums

JW Player for Flash & HTML5 Video
[resolved] [Plugin: JW Player Plugin for WordPress] Insert JW Player plugin into a widget (8 posts)

  1. richiesun
    Member
    Posted 4 years ago #

    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.

  2. JW Player
    Member
    Plugin Author

    Posted 4 years ago #

    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.

  3. richiesun
    Member
    Posted 4 years ago #

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

  4. richiesun
    Member
    Posted 4 years ago #

    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.

  5. JW Player
    Member
    Plugin Author

    Posted 4 years ago #

    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!

  6. thibotus01
    Member
    Posted 3 years ago #

    I'll be glad to see that update :) I'm also looking for to use the plugin in a widget.
    thanks!

  7. brnater
    Member
    Posted 3 years ago #

    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?

  8. JW Player
    Member
    Plugin Author

    Posted 3 years ago #

    @slimzinaminor,

    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?

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic