<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nerdaphernalia &#187; Webcraft</title>
	<atom:link href="http://striderweb.com/nerdaphernalia/category/webcraft/feed/" rel="self" type="application/rss+xml" />
	<link>http://striderweb.com/nerdaphernalia</link>
	<description>"It's All Geek To Me"</description>
	<lastBuildDate>Wed, 21 Dec 2011 18:51:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to Close a WordPress Site</title>
		<link>http://striderweb.com/nerdaphernalia/2011/05/how-to-close-a-wordpress-site/</link>
		<comments>http://striderweb.com/nerdaphernalia/2011/05/how-to-close-a-wordpress-site/#comments</comments>
		<pubDate>Wed, 18 May 2011 20:10:54 +0000</pubDate>
		<dc:creator>Stephen R</dc:creator>
				<category><![CDATA['Nuff  said]]></category>
		<category><![CDATA[Webcraft]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=272</guid>
		<description><![CDATA[I recently was asked to close down a site I had put up using WordPress. I didn&#8217;t want to just delete the whole thing, as I figured somebody might want it put back up in the future. There are several easy ways to do this, but I think I&#8217;ve found the best. My first impulse [...]]]></description>
			<content:encoded><![CDATA[<p>I recently was asked to close down a site I had put up using WordPress.  I didn&#8217;t want to just delete the whole thing, as I figured somebody might want it put back up in the future.  There are several easy ways to do this, but I think I&#8217;ve found the best.</p>
<p>My first impulse was to add an <code>exit;</code> line to index.php.  The problem there is that it doesn&#8217;t close off the wp-admin section.  I could comment out the database password in config, but that leaves a &#8220;Could not connect to database&#8221; message.  I wanted every aspect of the site gone.  Then it struck me:  One file that absolutely every single call to WordPress must pass through is <code>wp-config.php</code>.</p>
<p>So if you want to &#8220;disappear&#8221; a WordPress site quickly and easily, just open up <code>wp-config.php</code> and add the following right after the opening PHP tag:</p>
<p><code>exit;</code></p>
<p>If you want to put up some kind of &#8220;goodbye&#8221; message in HTML, you can do something like this at the top of that file:</p>
<pre><code>&lt;?php
?&gt;&lt;!DOCTYPE html&gt;
&lt;html&gt;&lt;body&gt;&lt;p&gt;This site is closed.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;
&lt;?php
exit;

...</code></pre>
<p>Even more briefly, of course, you could stick a short message inside a <code>die()</code> statement.  The HTML gives you a bit more flexibility though.</p>
<p>Hope somebody finds this useful. <img src='http://striderweb.com/nerdaphernalia/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<hr />
© <a href="http://striderweb.com/">Stephen Rider</a> 2011
<p>This article was originally published at <a href="http://striderweb.com/nerdaphernalia">Nerdaphernalia</a>.  <a href="http://planetwordpress.planetozh.com/" rel="nofollow">Planet WordPress</a> is authorized to reproduce WordPress-related entries.  <em>If you're reading this at any other web site, the site owner is stealing copyrighted work.  Please visit the original page:</em></p>

<small><a href="http://striderweb.com/nerdaphernalia/2011/05/how-to-close-a-wordpress-site/">Permalink to How to Close a WordPress Site</a></small>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://striderweb.com/nerdaphernalia/2011/05/how-to-close-a-wordpress-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Virtual Multiblog 2.6.1</title>
		<link>http://striderweb.com/nerdaphernalia/2009/07/virtual-multiblog-2-6-1/</link>
		<comments>http://striderweb.com/nerdaphernalia/2009/07/virtual-multiblog-2-6-1/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 04:38:35 +0000</pubDate>
		<dc:creator>Stephen R</dc:creator>
				<category><![CDATA[Webcraft]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[updates]]></category>
		<category><![CDATA[Virtual Multiblog]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/2009/07/virtual-multiblog-2-6-1/</guid>
		<description><![CDATA[Just released Virtual Multiblog v2.6.1. The primary new feature in the 2.6 line is auto-plugins. That is, you can specify plugins that are automatically activated for all (or just some) blogs. Check it out! © Stephen Rider 2009 This article was originally published at Nerdaphernalia. Planet WordPress is authorized to reproduce WordPress-related entries. If you're [...]]]></description>
			<content:encoded><![CDATA[<p>Just released Virtual Multiblog v2.6.1. The primary new feature in the 2.6 line is auto-plugins.</p>
<p>That is, you can specify plugins that are automatically activated for all (or just some) blogs.</p>
<p><a href="/nerdaphernalia/features/virtual-multiblog/">Check it out!</a> </p>
<hr />
© <a href="http://striderweb.com/">Stephen Rider</a> 2009
<p>This article was originally published at <a href="http://striderweb.com/nerdaphernalia">Nerdaphernalia</a>.  <a href="http://planetwordpress.planetozh.com/" rel="nofollow">Planet WordPress</a> is authorized to reproduce WordPress-related entries.  <em>If you're reading this at any other web site, the site owner is stealing copyrighted work.  Please visit the original page:</em></p>

<small><a href="http://striderweb.com/nerdaphernalia/2009/07/virtual-multiblog-2-6-1/">Permalink to Virtual Multiblog 2.6.1</a></small>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://striderweb.com/nerdaphernalia/2009/07/virtual-multiblog-2-6-1/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Strider Core &#8212; coming soon</title>
		<link>http://striderweb.com/nerdaphernalia/2009/02/strider-core-coming-soon/</link>
		<comments>http://striderweb.com/nerdaphernalia/2009/02/strider-core-coming-soon/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 16:09:45 +0000</pubDate>
		<dc:creator>Stephen R</dc:creator>
				<category><![CDATA[Codecraft]]></category>
		<category><![CDATA[Webcraft]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=248</guid>
		<description><![CDATA[I'm working on an integrated core system for WordPress plugins -- including common code and automatic "best version" detection of more than one plugin uses the same core.]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been pretty quiet around here lately, mainly because I&#8217;ve been working on something but having trouble hammering the last few problems out of it.</p>
<p>As I work on the various plugins I make for WordPress, I find that there are several common bits of code appearing in all of them, and as I improved it in one place I would then have to go through and copy/paste (with modifications here and there) to the other plugins.  This is a pain to keep track of, so I figured it would be a good idea to create a set of &#8220;core&#8221; files that I could simply drop in and have work.  I found this had various implications, such as what happens when two plugins are using the same core set &#8212; duplicate function names and conflicts suddenly started popping up.  How about when two plugins have differing versions of the core files?</p>
<p>So Strider Core was born.  Among other things, I&#8217;ve created a system wherein different plugins can all run on Strider Core, and if they each have different versions of the core files, it will figure out which one has the <em>highest</em> version and use that for <em>all of those plugins</em>.  Thus if Plugin A includes Strider Core 1.0, and Plugin B has Strider Core 1.1, the 1.1 core will be loaded for both plugins.  Thus, <span class="pullquote">activating one plugin can actually improve the functionality of other plugins</span>.</p>
<p>Most of what I&#8217;m including in the first go are little bits of polish for the Admin &#8212; such as settings links from the Manage Plugins page, Menu icons, and the like.  One significant addition, however, (and the thing I can&#8217;t quite get working right&#8230;) is a third party version checking system.  Thus, anyone who makes plugins that are not hosted on WP-Extend will be able to have their plugin check for new versions simply by integrating Strider Core and adding a single line to the code.</p>
<p>That&#8217;s the plan anyway.</p>
<p>I&#8217;m going to try and get things going this weekend (with some luck), but even if I don&#8217;t get the version checking going, I will probably do a &#8220;beta&#8221; release so people can see what&#8217;s happening.  I know some people have expressed interest in this system, so perhaps better to get it out sooner and get feedback before the &#8220;prime time&#8221; release.</p>
<p>If you&#8217;re interested, keep a lookout for an update to my <a href="/nerdaphernalia/features/wp-log-deprecated-calls/">Log Deprecated Calls plugin</a>, as that is going to be the first plugin to use the new system.</p>
<hr />
© <a href="http://striderweb.com/">Stephen Rider</a> 2009
<p>This article was originally published at <a href="http://striderweb.com/nerdaphernalia">Nerdaphernalia</a>.  <a href="http://planetwordpress.planetozh.com/" rel="nofollow">Planet WordPress</a> is authorized to reproduce WordPress-related entries.  <em>If you're reading this at any other web site, the site owner is stealing copyrighted work.  Please visit the original page:</em></p>

<small><a href="http://striderweb.com/nerdaphernalia/2009/02/strider-core-coming-soon/">Permalink to Strider Core &#8212; coming soon</a></small>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://striderweb.com/nerdaphernalia/2009/02/strider-core-coming-soon/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Comment Quiz plugin v1.1.1</title>
		<link>http://striderweb.com/nerdaphernalia/2008/11/comment-quiz-plugin-v111/</link>
		<comments>http://striderweb.com/nerdaphernalia/2008/11/comment-quiz-plugin-v111/#comments</comments>
		<pubDate>Sat, 29 Nov 2008 20:40:16 +0000</pubDate>
		<dc:creator>Stephen R</dc:creator>
				<category><![CDATA[Webcraft]]></category>
		<category><![CDATA[Comment Quiz]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[updates]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=243</guid>
		<description><![CDATA[A new version of the Comment Quiz plugin is up. 1.1.1 has some important bug fixes, so if you&#8217;re using any earlier version, I highly recommend picking this up. I finally figured out SVN, so it&#8217;s on the official WordPress repository. In layman&#8217;s terms that means that automatic update will do the job for you [...]]]></description>
			<content:encoded><![CDATA[<p>A new version of the Comment Quiz plugin is up.  1.1.1 has some important bug fixes, so if you&#8217;re using any earlier version, I <strong>highly</strong> recommend picking this up.</p>
<p>I finally figured out <abbr title "Subversion version control software">SVN</abbr>, so it&#8217;s on the official <a href="http://wordpress.org/extend/plugins/quiz/">WordPress repository</a>.  In layman&#8217;s terms that means that automatic update will do the job for you (look at the Plugins page in Admin).</p>
<p><a href="/nerdaphernalia/features/wp-comment-quiz/">Here&#8217;s the link</a>.  Check it out for details.  Mainly bugfixes since 1.1, but a few other changes in the mix as well&#8230;.</p>
<hr />
© <a href="http://striderweb.com/">Stephen Rider</a> 2008
<p>This article was originally published at <a href="http://striderweb.com/nerdaphernalia">Nerdaphernalia</a>.  <a href="http://planetwordpress.planetozh.com/" rel="nofollow">Planet WordPress</a> is authorized to reproduce WordPress-related entries.  <em>If you're reading this at any other web site, the site owner is stealing copyrighted work.  Please visit the original page:</em></p>

<small><a href="http://striderweb.com/nerdaphernalia/2008/11/comment-quiz-plugin-v111/">Permalink to Comment Quiz plugin v1.1.1</a></small>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://striderweb.com/nerdaphernalia/2008/11/comment-quiz-plugin-v111/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Virtual Multiblog 2.5</title>
		<link>http://striderweb.com/nerdaphernalia/2008/11/virtual-multiblog-25/</link>
		<comments>http://striderweb.com/nerdaphernalia/2008/11/virtual-multiblog-25/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 19:52:53 +0000</pubDate>
		<dc:creator>Stephen R</dc:creator>
				<category><![CDATA[Webcraft]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[updates]]></category>
		<category><![CDATA[Virtual Multiblog]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=236</guid>
		<description><![CDATA[I&#8217;ve just released Virtual Multiblog for WordPress version 2.5. This has some significant bug fixes and other improvements. If you&#8217;ve had trouble getting it to work in the past, I&#8217;ve reworked the code that determines which blog is active, and I think this will help a lot of people. A major improvement in this version [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just released <a href="http://striderweb.com/nerdaphernalia/features/virtual-multiblog/">Virtual Multiblog for WordPress</a> version 2.5.  This has some significant bug fixes and other improvements.  If you&#8217;ve had trouble getting it to work in the past, I&#8217;ve reworked the code that determines which blog is active, and I think this will help a lot of people.</p>
<p>A major improvement in this version is the way it handles defaults.  Now you can set up defaults in the autoconfig file, and put <em>just the differences</em> into blog-specific config files.  For example, if all your blogs use the same database, you can set the database info one time in <code>mb-autoconfig.php</code>, and then make blog-specific config files that only contain the table-prefix and nothing else.</p>
<p>If you are upgrading, from a previous version, please note the following instructions:</p>
<h3>Upgrading</h3>
<p>1) Upload the new multiblog folder to your wp-content directory.  Copy <code>wp-config.php</code> <del datetime="2009-09-02T15:42:34+00:00" title-"this bit is obsolete">and <code>wp-config-vmb.php</code></del> to the root WordPress directory.  <span class="update">[Update: New versions of VMB no longer use the <code>wp-config-vmb.php</code> file.  If you have it you can get rid of it; if you *don't* have it, don't worry about it. <img src='http://striderweb.com/nerdaphernalia/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ]</span></p>
<p>2) The system no longer uses <code>define()</code> in the config files.  Instead we are setting constants via an array called <code>$vmb_const[]</code>.  For backwards compatibility, defines in blog-specific config files will still work for now (though it is deprecated).  Any constants set in the autoconfig <strong>must</strong> use <code>$vmb_const[]</code>.</p>
<p>3) Note that both mb-autoconfig.php and mb-config-{blog}.php will now be loaded (previously it was either/or).  Anything set in autoconfig will be overridden by a matching pref in a blog-specific file.</p>
<p>That&#8217;s about it.  Check out the readme and the FAQ if you&#8217;re having issues.  Here&#8217;s the page again:  <a href="http://striderweb.com/nerdaphernalia/features/virtual-multiblog/">Virtual Multiblog for WordPress</a>.</p>
<hr />
© <a href="http://striderweb.com/">Stephen Rider</a> 2008
<p>This article was originally published at <a href="http://striderweb.com/nerdaphernalia">Nerdaphernalia</a>.  <a href="http://planetwordpress.planetozh.com/" rel="nofollow">Planet WordPress</a> is authorized to reproduce WordPress-related entries.  <em>If you're reading this at any other web site, the site owner is stealing copyrighted work.  Please visit the original page:</em></p>

<small><a href="http://striderweb.com/nerdaphernalia/2008/11/virtual-multiblog-25/">Permalink to Virtual Multiblog 2.5</a></small>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://striderweb.com/nerdaphernalia/2008/11/virtual-multiblog-25/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Virtual Multibug</title>
		<link>http://striderweb.com/nerdaphernalia/2008/10/virtual-multibug/</link>
		<comments>http://striderweb.com/nerdaphernalia/2008/10/virtual-multibug/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 20:11:46 +0000</pubDate>
		<dc:creator>Stephen R</dc:creator>
				<category><![CDATA[Webcraft]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[fixes]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[Virtual Multiblog]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=234</guid>
		<description><![CDATA[I received a comment recently tipping me off to a bug in my Virtual Multiblog system for WordPress. In certain cases, the system will show one particular blog no matter which address you go to. If you&#8217;re having this problem and you&#8217;re using the $vusers[] list, try changing the order of the $vusers[] list. This [...]]]></description>
			<content:encoded><![CDATA[<p>I received a comment recently tipping me off to a bug in my <a href="/nerdaphernalia/features/virtual-multiblog/">Virtual Multiblog</a> system for WordPress.  In certain cases, the system will show one particular blog no matter which address you go to.</p>
<p>If you&#8217;re having this problem and you&#8217;re using the $vusers[] list, try changing the order of the $vusers[] list.  This alone may fix things.</p>
<p>I&#8217;ll try to get a &#8220;real&#8221; fix out soon (probably this weekend).  A new version should be coming out anyway within days. <img src='http://striderweb.com/nerdaphernalia/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<hr />
© <a href="http://striderweb.com/">Stephen Rider</a> 2008
<p>This article was originally published at <a href="http://striderweb.com/nerdaphernalia">Nerdaphernalia</a>.  <a href="http://planetwordpress.planetozh.com/" rel="nofollow">Planet WordPress</a> is authorized to reproduce WordPress-related entries.  <em>If you're reading this at any other web site, the site owner is stealing copyrighted work.  Please visit the original page:</em></p>

<small><a href="http://striderweb.com/nerdaphernalia/2008/10/virtual-multibug/">Permalink to Virtual Multibug</a></small>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://striderweb.com/nerdaphernalia/2008/10/virtual-multibug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Pull-Quotes 2.2 for WordPress</title>
		<link>http://striderweb.com/nerdaphernalia/2008/09/javascript-pull-quotes-22-for-wordpress/</link>
		<comments>http://striderweb.com/nerdaphernalia/2008/09/javascript-pull-quotes-22-for-wordpress/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 16:01:54 +0000</pubDate>
		<dc:creator>Stephen R</dc:creator>
				<category><![CDATA[Webcraft]]></category>
		<category><![CDATA[plugin updates]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[pull-quotes]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=224</guid>
		<description><![CDATA[I just uploaded the new version 2.2 of my JavaScript Pull-Quotes plugin for WordPress. Improvements: German translation (Danke Mattias&#8230; or is it &#8220;Dank&#8220;?) Updated the .po files for people creating or updating translations Improvements to how the system handles changes to the contents of the &#8220;styles&#8221; folder. A menu icon for those using Ozh&#8217;s Admin [...]]]></description>
			<content:encoded><![CDATA[<p>I just uploaded the new version 2.2 of my <a href="http://striderweb.com/nerdaphernalia/features/wp-javascript-pull-quotes/">JavaScript Pull-Quotes plugin</a> for WordPress.</p>
<p>Improvements:</p>
<ul>
<li>German translation (<span lang="de" class="foreign">Danke</span> Mattias&#8230; or is it &#8220;<span lang="de" class="foreign">Dank</span>&#8220;?)</li>
<li>Updated the .po files for people creating or updating translations</li>
<li>Improvements to how the system handles changes to the contents of the &#8220;styles&#8221; folder.</li>
<li>A menu icon for those using Ozh&#8217;s <a href="http://planetozh.com/blog/my-projects/wordpress-admin-menu-drop-down-css/">Admin Drop Down Menu plugin</a></li>
</ul>
<p>&#8230;plus the usual regimen of minor code improvements here and there.</p>
<hr />
© <a href="http://striderweb.com/">Stephen Rider</a> 2008
<p>This article was originally published at <a href="http://striderweb.com/nerdaphernalia">Nerdaphernalia</a>.  <a href="http://planetwordpress.planetozh.com/" rel="nofollow">Planet WordPress</a> is authorized to reproduce WordPress-related entries.  <em>If you're reading this at any other web site, the site owner is stealing copyrighted work.  Please visit the original page:</em></p>

<small><a href="http://striderweb.com/nerdaphernalia/2008/09/javascript-pull-quotes-22-for-wordpress/">Permalink to JavaScript Pull-Quotes 2.2 for WordPress</a></small>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://striderweb.com/nerdaphernalia/2008/09/javascript-pull-quotes-22-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Hit a Moving Target in your WordPress Plugin</title>
		<link>http://striderweb.com/nerdaphernalia/2008/09/hit-a-moving-target-in-your-wordpress-plugin/</link>
		<comments>http://striderweb.com/nerdaphernalia/2008/09/hit-a-moving-target-in-your-wordpress-plugin/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 17:54:09 +0000</pubDate>
		<dc:creator>Stephen R</dc:creator>
				<category><![CDATA[Codecraft]]></category>
		<category><![CDATA[Webcraft]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[constants]]></category>
		<category><![CDATA[paths]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=209</guid>
		<description><![CDATA[In recent changes to WordPress code, users are more than ever able to customize folder and file locations. [Edit: Refers to WordPress 2.6] The wp-config.php file can now be located one directory up from the one containing WordPress. The wp-content folder can be moved arbitrarily, as can (separately) the plugins folder. What&#8217;s a poor plugin [...]]]></description>
			<content:encoded><![CDATA[<p>In recent changes to WordPress code, users are more than ever able to customize folder and file locations.  <span class="update">[Edit: Refers to WordPress 2.6]</span>  The <code>wp-config.php</code> file can now be located one directory up from the one containing WordPress.  The <code>wp-content</code> folder can be moved arbitrarily, as can (separately) the <code>plugins</code> folder.  What&#8217;s a poor plugin author to do in keeping track of these ever-moving targets?</p>
<p>When those last two folders are moved, it is done by defining specific constants: <code>WP_CONTENT_DIR</code> and <code>WP_CONTENT_URL</code> for the <code>wp-content</code> folder, and <code>WP_PLUGIN_DIR</code> and <code>WP_PLUGIN_URL</code> for the <code>plugins</code> folder.  In plugins it&#8217;s best to use these, except that they are not defined in a default setup, and don&#8217;t <em>exist</em> in earlier versions of WordPress.</p>
<p>The solution, fortunately, is simple:  Check if they are already defined.  If they&#8217;re not, then the folders are in the default locations and you can define them accordingly.  Then just use the constants as normal.  Here&#8217;s the code; just drop this somewhere in the beginning of your plugin:</p>
<pre><code>if ( ! defined( 'WP_CONTENT_URL' ) )
	define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/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' );</code></pre>
<p>There are a couple things to note:</p>
<ul>
<li>By defining these, you might actually fix problems in other plugins &#8212; ones that assume these are defined and call them without checking.</li>
<li>I recommend <em>not</em> using the older <code>PLUGINDIR</code> constant at all.  It is both obsolete and problematic.  Use <code>WP_PLUGIN_DIR</code> instead.</li>
<li>You might be tempted to set <code>WP_PLUGIN_DIR</code> as something like <code>dirname(dirname(__FILE__))</code>.  Don&#8217;t.  First, it&#8217;s inefficient, as it unnecessarily calls <code>dirname()</code> twice.  Second, I&#8217;ve seen (albeit unusual) situations where it <a href="#fnote209_1" class="fnotelink">caused problems<sup>*</sup></a>.</li>
</ul>
<p>So.  Not so complicated after all &#8212; it&#8217;s just one of those rote things that&#8217;s helpful to know.  Use those four constants and you shouldn&#8217;t go wrong finding the right paths in WordPress.</p>
<div class="fnote" id="fnote209_1">*: Specifically, a plugin was being shared between two WP installs with a symlink.  Running in the second blog the plugin was calling the directory of the first blog.</div>
<hr />
© <a href="http://striderweb.com/">Stephen Rider</a> 2008
<p>This article was originally published at <a href="http://striderweb.com/nerdaphernalia">Nerdaphernalia</a>.  <a href="http://planetwordpress.planetozh.com/" rel="nofollow">Planet WordPress</a> is authorized to reproduce WordPress-related entries.  <em>If you're reading this at any other web site, the site owner is stealing copyrighted work.  Please visit the original page:</em></p>

<small><a href="http://striderweb.com/nerdaphernalia/2008/09/hit-a-moving-target-in-your-wordpress-plugin/">Permalink to Hit a Moving Target in your WordPress Plugin</a></small>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://striderweb.com/nerdaphernalia/2008/09/hit-a-moving-target-in-your-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

