[wp-hackers] best method for figuring out where a plugin is.
Austin Matzko
if.website at gmail.com
Mon Apr 14 00:21:52 GMT 2008
On Sun, Apr 13, 2008 at 7:45 PM, dubayou <dubayou at gmail.com> wrote:
> im working on a plugin, and when im building links i dont know to call
>
> ?page=widget-profiles/widgetprofiles.php
> or
> ?page=widgetprofiles.php
>
> in the code if i use just __FILE__ it fails if its installed in a folder?
> know i have a little monkey hack to fix it for now, but whats the best
> way to get the installed path of your plugin.
When calling the admin menu functions, such as add_submenu_page, you
can pass an arbitrary string for the $file argument, instead of the
file path itself.
So in your case you could do something like the following:
add_submenu_page('themes.php', __('Widgets Profiles',
'widgetprofiles'), __('Widgets Profiles',''widgetprofiles'),
'switch_themes', 'widgetprofiles', 'widgetprofiles_run');
More information about the wp-hackers
mailing list