Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

plugin path not set correctly WordPress

  • REFUNDED

I have a plugin that has not been written correctly.
It calls the path:

echo bloginfo('template_url');
echo "/wtf/player/swfobject.js'>



This is calling a path (actually it calls styles, js and a htm5 player) to the wtf folder in the theme path instead of the plugin path.

I have tried enqueueing the scripts but they are not working.
I have tried changing paths to plugins_url etc which is on the wordpress codex page, but I am obviously not doing it correctly.

So my first step is to figure out how to change the above path to the plugins directory instead of the theme directory.

How can I do this?

Should be a very quick simple solution, I am missing something.

Answers (4)

2014-04-12

Remy answers:

plugins_url( 'wtf/player/swfobject.js', __FILE__ ); doesn't work ?


Graham Kite comments:

Is breaking the php somehow, can't see it and it should be working.


Remy comments:

Do you have WP_DEBUG set to TRUE ?


Graham Kite comments:

yes but I am not seeing any errors


Remy comments:

2 alternatives :
- Use another plugin, I think you can find better written plugins for video player
- Copy the wtf folder and its content to your theme directory, so the plugin finds the files, even with its bad code


Graham Kite comments:

all I get is an error at the get footer closing tag or the site breaks when it calls the very last closing (get footer tag)


Graham Kite comments:

I have the folder in three places. It only work if in the theme directory. It's not just the player unfortunately. There are probably other plugins that would do something similar, but I know and like how this one works, so I really want to try and figure it out.

It should be working and it should be very simple. It's 2 am and I am just not seeing it

2014-04-12

Arnav Joy answers:

You can use plugins_url () function which will give you url to plugin folder.


Graham Kite comments:

plugins_url() does not work at all

2014-04-12

Ryan S answers:

It should be,

// TEMPLATE
$template_wtf_path = get_bloginfo('template_directory') . '/wtf/player/swfobject.js';

// PLUGIN
$plugin_wtf_path = plugin_dir_path( __FILE__ );


Hope that helps


Graham Kite comments:

Would I define that path?


Graham Kite comments:

Calling it quits way to late, in theory all of these should work, I can't get a single one to work


Ryan S comments:

yeah for later use or you can call it directly

2014-04-12

Thomas Varghese answers:

This should work.
plugin_dir_url(__FILE__).'wtf/player/swfobject.js'


Thomas Varghese comments:

Did you try the answer i suggested?


Graham Kite comments:

should I keep the bloginfo or get rid of it?


Thomas Varghese comments:

wp_enqueue_script('name-js', plugin_dir_url(__FILE__).'wtf/player/swfobject.js');


Thomas Varghese comments:

Please try this answer and let me know.


Thomas Varghese comments:

Any success?


Graham Kite comments:

no that did not work. I can see where the issue is I even tried wp_plugin_dir and it did not work.

I am going to cancel this question and post another one offering either the plugin to fix, or paste the exact code that is causing the issue and pay more. It should be a very quick fix, but there is a lot of inline style and js. I think it would be better in this case to offer more and get someone else to look at it.