[wp-hackers] WP_CONTENT_DIR and PLUGINDIR
Frank Bueltge
frank at bueltge.de
Mon Sep 8 19:14:17 GMT 2008
// Pre-2.6 compatibility
if ( !defined('WP_CONTENT_URL') )
define( 'WP_CONTENT_URL', get_option('url') . '/wp-content');
if ( !defined('WP_CONTENT_DIR') )
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
if ( !defined('WP_PLUGIN_URL') )
define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
Thats my way in all plugins, i checl for the constants
Liebe Grüsse
Frank
______________________________
Mein Buch: WordPress - Weblogs einrichten und administrieren | ISBN
978-3-937514-33-8
bueltge.de
kvfl.com
On Mon, Sep 8, 2008 at 4:42 PM, Stephen Rider <wp-hackers at striderweb.com> wrote:
>
> On Sep 7, 2008, at 5:28 AM, DD32 wrote:
>
>> I'm not too sure of the way forward for it to work, But PLUGINDIR is
>> relative to ABSPATH, whilst WP_CONTENT_DIR is not relative, but rather,
>> absolute, Because of that, PLUGINDIR can never 100% be set correctly
>> automatically (without using ../../../../)
>
>> A more future-compat version might be:
>
>> if ( ! defined('WP_PLUGIN_DIR') )
>> define('WP_PLUGIN_DIR', dirname(dirname(__FILE__)));
>> and then simply use WP_PLUGIN_DIR instead of worrying about ABSPATH /
>> PLUGINDIR
>
> That's generally my way to go lately: Check if the newer constant has been
> defined, and if not, define it, then use it normally. That way your plugin
> works just fine even in WP versions before the constant existed.
>
> To Viper -- I wasn't trying to criticize wPhone. The WP app
> notwithstanding, I still love this plugin, and I hope it continues to be
> developed -- at least for base compatibility purposes.
>
> Stephen
>
> --
> Stephen Rider
> <http://striderweb.com/>
>
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list