[wp-hackers] WP_CONTENT_DIR and PLUGINDIR
Jeremy Clarke
jer-wphackers at simianuprising.com
Tue Sep 9 16:22:40 GMT 2008
This seems pretty useful/important so I added it to the codex:
http://codex.wordpress.org/Determining_Plugin_and_Content_Directories
linked from: http://codex.wordpress.org/Plugin_Resources#Plugin_Development_Basics
If a couple of you who worked that code out could read it and make
sure I'm not leading anyone astray that would be great. (esp. Sam
Bauers if you're reading this, as my brain exploded when I tried to
think whether this would work with the process you described in your
wcsf talk: http://unlettered.org/2008/08/17/wordcamp-presentations/ ).
--
Jeremy Clarke | http://simianuprising.com
Code and Design | http://globalvoicesonline.org
On Tue, Sep 9, 2008 at 11:48 AM, Frank Bueltge <frank at bueltge.de> wrote:
> I dont use this two constants before in other plugins.
>
> only point: get_option('siteurl') is better as url
>
> Liebe Grüsse
> Frank
> ______________________________
> Mein Buch: WordPress - Weblogs einrichten und administrieren | ISBN
> 978-3-937514-33-8
>
> bueltge.de
> kvfl.com
>
>
>
> On Tue, Sep 9, 2008 at 3:25 PM, Stephen Rider <wp-hackers at striderweb.com> wrote:
>> On Sep 8, 2008, at 2:14 PM, Frank Bueltge wrote:
>>
>>> // 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
>>
>> Cool, but methinks this works a touch better. You're forgetting WP_SITEURL,
>> and I added WP_PLUGIN_DIR for completeness:
>>
>> // Pre-2.6 compatibility
>> if ( ! defined( 'WP_CONTENT_URL' ) ) {
>> if ( defined( 'WP_SITEURL' ) )
>> define( 'WP_CONTENT_URL', WP_SITEURL . '/wp-content' );
>> else
>> 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' );
>> if ( ! defined( 'WP_PLUGIN_DIR' ) )
>> define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
>>
>>
>> The answer to the ambiguity of PLUGINDIR is of course simply not to use it.
>> :)
>>
>> Stephen
>>
>>
>> --
>> Stephen Rider
>> <http://striderweb.com/>
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
> _______________________________________________
> 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