<?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; code</title>
	<atom:link href="http://striderweb.com/nerdaphernalia/tag/code/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>Search Everywhere in MySQL</title>
		<link>http://striderweb.com/nerdaphernalia/2010/05/search-everywhere-in-mysql/</link>
		<comments>http://striderweb.com/nerdaphernalia/2010/05/search-everywhere-in-mysql/#comments</comments>
		<pubDate>Mon, 17 May 2010 16:04:35 +0000</pubDate>
		<dc:creator>Stephen R</dc:creator>
				<category><![CDATA['Nuff  said]]></category>
		<category><![CDATA[Gadgets and Gewgaws]]></category>
		<category><![CDATA[On the Front Lines]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[utilities]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/2010/05/search-everywhere-in-mysql/</guid>
		<description><![CDATA[In recent months I&#8217;ve been tasked with taking over management of a web site programmed by somebody else. They used Drupal, with which I&#8217;m not familiar, and so a big part of the job is simply figuring out how that system works. In many cases I&#8217;ve wanted to search the entire database for a particular [...]]]></description>
			<content:encoded><![CDATA[<p>In recent months I&#8217;ve been tasked with taking over management of a web site programmed by somebody else.  They used Drupal, with which I&#8217;m not familiar, and so a big part of the job is simply figuring out how that system works.  In many cases I&#8217;ve wanted to search the entire database for a particular string of text, in order simply to find out where certain data is stored in the database.</p>
<p>I hunted over the web looking for a way to search an entire MySQL database &#8212; all tables, all fields &#8212; for text.  For the most part I find forums with answers such as &#8220;Well, you set up your database wrong&#8221;.  These kinds of responses remind me of the sequence in the movie &#8220;Funny Farm&#8221; where the truck driver is trying to find the town of Redbud.  In short:</p>
<p>&#8220;Hey Mac, how do you get to Redbud?&#8221;</p>
<p>&#8220;If I wanted to go to Redbud, I wouldn&#8217;t start from here.&#8221;</p>
<p>Nonsensical and useless.  If you&#8217;re here now, then this is where you&#8217;re starting from; telling me to start from somewhere else is simply a non-answer.  <span class="pullquote">Funny in a movie, but frustrating in real life</span>.</p>
<p>Today I came across a most excellent script, the <a href="http://sewmyheadon.com/2009/mysql-search-replace-tool/">MySQL Database Search &#038; Replace Tool</a>.  It&#8217;s a PHP page that you can drop into a web site and call from your browser.  It will search the entire database for a string of text &#8212; exactly what I needed.</p>
<p>In a quick test run it threw out a couple errors but then gave me useful results; so it&#8217;s not entirely polished, but quite functional and useful.  Kudos to <a href="http://www.mgdigital.co.uk/">Mark Jackson</a> and <a href="http://sewmyheadon.com">Eric Amundson</a> for releasing this great tool!</p>
<hr />
© <a href="http://striderweb.com/">Stephen Rider</a> 2010
<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/2010/05/search-everywhere-in-mysql/">Permalink to Search Everywhere in MySQL</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/2010/05/search-everywhere-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add New Headers to WordPress Plugins or Themes</title>
		<link>http://striderweb.com/nerdaphernalia/2009/11/add-new-headers-to-wordpress-plugins-or-themes/</link>
		<comments>http://striderweb.com/nerdaphernalia/2009/11/add-new-headers-to-wordpress-plugins-or-themes/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 22:25:11 +0000</pubDate>
		<dc:creator>Stephen R</dc:creator>
				<category><![CDATA[Codecraft]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=266</guid>
		<description><![CDATA[I&#8217;ve had a few patches committed to WordPress core in the last few versions, and have sadly neglected to do writeups about them so that others could take advantage of the new features. I hope to remedy that in the next few posts. First off, WordPress 2.9 has a new feature that allows you to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a few patches committed to WordPress core in the last few versions, and have sadly neglected to do writeups about them so that others could take advantage of the new features.  I hope to remedy that in the next few posts.  First off, WordPress 2.9 has a new feature that allows you to add to the list of headers that are checked when you run either <code>get_plugin_data()</code> or <code>get_theme_data()</code>.</p>
<p>For example:  Let&#8217;s say you want to make a plugin that works with other plugins.  For other plugins to be compatible with it, however, they need to provide some new piece of information, and you want to do this with a custom header.  So we&#8217;re going declare a new plugin header.  Let&#8217;s call it&#8230; oh&#8230;. &#8220;Demo Header&#8221;.  Here&#8217;s the code; just drop this in a plugin and activate:</p>
<pre><code>function plugin_header_demo( $extra_headers ) {
	$extra_headers[] = 'Demo Header';
	return $extra_headers;
}
add_filter( 'extra_plugin_headers', 'plugin_header_demo' );</code></pre>
<p>Pretty simple, eh?  What we&#8217;ve just done is added &#8220;Demo Header&#8221; to the list of headers that WordPress will check for when <code>get_plugin_data()</code> is run.   Now, along with Name, Version, Author, and so forth, a value for Demo Header is returned as well.</p>
<p>Note that this is only for cases where you want <em>any</em> plugin checked for this header.  This changes the <code>get_plugin_data()</code> function and takes effect every time that function is run, on any plugin.</p>
<p>Want to do it for themes?  The code is almost identical:</p>
<pre><code>function theme_header_demo( $extra_headers ) {
	$extra_headers[] = 'Demo Header';
	return $extra_headers;
}
add_filter( 'extra_theme_headers', 'theme_header_demo' );</code></pre>
<p>Note that this does not allow you to alter the pre-existing headers in any way.  You can&#8217;t, for example, remove the &#8220;Name&#8221; header.</p>
<p>Personally, I intend to use this for a third-party update check plugin, which will also be incorporated into <a href="http://code.google.com/p/strider-core/">Strider Core</a>.  For that use, I&#8217;ll add an &#8220;Update URL&#8221; header (or similar).</p>
<p>Next up:  How to define your own custom <code>get_XXX_data()</code> function that works like the ones for plugins or themes.</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/11/add-new-headers-to-wordpress-plugins-or-themes/">Permalink to Add New Headers to WordPress Plugins or Themes</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/11/add-new-headers-to-wordpress-plugins-or-themes/feed/</wfw:commentRss>
		<slash:comments>0</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>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>
		<item>
		<title>Virtual Multiblog &#8212; how to use unique headers on blogs running the same theme</title>
		<link>http://striderweb.com/nerdaphernalia/2008/08/vmb-unique-headers-on-blogs-running-the-same-theme/</link>
		<comments>http://striderweb.com/nerdaphernalia/2008/08/vmb-unique-headers-on-blogs-running-the-same-theme/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 15:58:01 +0000</pubDate>
		<dc:creator>Stephen R</dc:creator>
				<category><![CDATA[Codecraft]]></category>
		<category><![CDATA[Webcraft]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[customization]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[Virtual Multiblog]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=182</guid>
		<description><![CDATA[One of the most common questions I get regarding the Virtual Multiblog system for WordPress comes from people wanting to have multiple blogs running on the same theme, but with a different header for each blog. It can be done, and it&#8217;s fairly easy to do. Once you have it set up, you could use [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most common questions I get regarding the <a href="http://striderweb.com/nerdaphernalia/features/virtual-multiblog/">Virtual Multiblog</a> system for WordPress comes from people wanting to have multiple blogs running on the same theme, but with a different header for each blog.  It can be done, and it&#8217;s fairly easy to do.  Once you have it set up, you could use it to call <em>any</em> distinct file on a per-blog basis &#8212; a different CSS file, or a different footer perhaps.</p>
<p>I&#8217;ve never been too active about showing this to people, because the function required to do it is not one I consider completely stable &#8212; I din&#8217;t want to show people how to do it only to have it break the next time I update the VMB system.  In response to the requests, however, I am adding a function to the upcoming release (currently in private beta).  You can have that ability right now, in a way that should not cause problems with later updates &#8212; just add a short function to your existing vmb-functions.php file.<br />
(...)<br/>Read the rest of <a href="http://striderweb.com/nerdaphernalia/2008/08/vmb-unique-headers-on-blogs-running-the-same-theme/">Virtual Multiblog &#8212; how to use unique headers on blogs running the same theme</a> (293 words)</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/08/vmb-unique-headers-on-blogs-running-the-same-theme/">Permalink to Virtual Multiblog &#8212; how to use unique headers on blogs running the same theme</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/08/vmb-unique-headers-on-blogs-running-the-same-theme/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>WordPress Constants</title>
		<link>http://striderweb.com/nerdaphernalia/2008/08/wordpress-constants/</link>
		<comments>http://striderweb.com/nerdaphernalia/2008/08/wordpress-constants/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 04:54:50 +0000</pubDate>
		<dc:creator>Stephen R</dc:creator>
				<category><![CDATA[Codecraft]]></category>
		<category><![CDATA[On the Front Lines]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[reference]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=178</guid>
		<description><![CDATA[In the course of working on WordPress, and plugins and such for WordPress, I frequently find myself at a loss to remember the name of constants provided by the system. Hey, isn&#8217;t there a constant for such-and-such directory? I did a bit of grepping and parsing just now, and in the hopes that it might [...]]]></description>
			<content:encoded><![CDATA[<p>In the course of working on WordPress, and plugins and such for WordPress, I frequently find myself at a loss to remember the name of constants provided by the system.  Hey, isn&#8217;t there a constant for such-and-such directory?</p>
<p>I did a bit of grepping and parsing just now, and in the hopes that it might be of use to my fellow WordPress hackers, here is my list of every defined CONSTANT in the latest WordPress 2.7-bleeding setup.<br />
(...)<br/>Read the rest of <a href="http://striderweb.com/nerdaphernalia/2008/08/wordpress-constants/">WordPress Constants</a> (170 words)</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/08/wordpress-constants/">Permalink to WordPress Constants</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/08/wordpress-constants/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Use Custom Actions in Your WordPress Plugins</title>
		<link>http://striderweb.com/nerdaphernalia/2008/08/use-custom-actions-in-your-wordpress-plugins/</link>
		<comments>http://striderweb.com/nerdaphernalia/2008/08/use-custom-actions-in-your-wordpress-plugins/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 15:08:10 +0000</pubDate>
		<dc:creator>Stephen R</dc:creator>
				<category><![CDATA[Codecraft]]></category>
		<category><![CDATA[Webcraft]]></category>
		<category><![CDATA[add_action]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[do_action]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=172</guid>
		<description><![CDATA[If you&#8217;ve been using WordPress for any amount of time, you&#8217;ve probably come across a plugin that asks you to add something to your template. The instructions will say something like: Insert the following into your theme files where you want the plugin&#8217;s widget to appear: &#60;?php my_plugin_widget() ?&#62; The slightly more intelligent instructions will [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been using WordPress for any amount of time, you&#8217;ve probably come across a plugin that asks you to add something to your template.  The instructions will say something like:</p>
<blockquote><p>Insert the following into your theme files where you want the plugin&#8217;s widget to appear:</p>
<p><code >&lt;?php my_plugin_widget() ?&gt;</code>
</p></blockquote>
<p>The slightly more intelligent instructions will understand that the plugin might be deactivated, and suggest you wrap the function in an <code>if()</code> that checks for its existence:</p>
<pre><code >&lt;?php
if ( function_exists( 'my_plugin_widget' ) ) {
	my_plugin_widget();
}
?&gt;</code></pre>
<p>In your own plugins, you can streamline this for the end user by wrapping your function in a custom add_action.  How?  It&#8217;s incredibly easy.  Just add an <code>add_action()</code> to your plugin file, like so:</p>
<pre><code>add_action( 'show_my_plugin_widget', 'my_plugin_widget' );

function my_plugin_widget() {
	...
}</code></pre>
<p>Now your users can use one straightforward line in their templates.</p>
<pre><code>&lt;?php do_action('show_my_plugin_widget'); ?&gt;</code></pre>
<p>One short line of code.  No worrying about deactivated plugins.  A small extra effort on your end can save your end users some frustration down the road.</p>
<p class="note">Next Time: Cold Fusion!  (article may be delayed by technical feasibility)</p>
<p class="note">Previously: <a href="http://striderweb.com/nerdaphernalia/2008/07/use-classes-in-your-wordpress-plugins/">Use Classes in your WordPress plugins to increase code portability and reduce name conflicts</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/08/use-custom-actions-in-your-wordpress-plugins/">Permalink to Use Custom Actions in Your WordPress Plugins</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/08/use-custom-actions-in-your-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>More than a mere WordPress plugin &#8212; Automatic Timezone</title>
		<link>http://striderweb.com/nerdaphernalia/2008/08/more-than-a-mere-wordpress-plugin-automatic-timezone/</link>
		<comments>http://striderweb.com/nerdaphernalia/2008/08/more-than-a-mere-wordpress-plugin-automatic-timezone/#comments</comments>
		<pubDate>Sat, 09 Aug 2008 14:08:14 +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[quick links]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/2008/08/more-than-a-mere-wordpress-plugin-automatic-timezone/</guid>
		<description><![CDATA[Otto has released his Automatic Timezone Plugin as part of the current WordPress plugin competition. In addition to being a handy plugin, it comes with a significant bonus for plugin authors. In addition to its basic function, the code is designed to serve as a tutorial of sorts, showing authors how to use some very [...]]]></description>
			<content:encoded><![CDATA[<p>Otto has released his <a href="http://weblogtoolscollection.com/pluginblog/2008/06/19/automatic-timezone/">Automatic Timezone Plugin</a> as part of the current WordPress plugin competition.  In addition to being a handy plugin, <span class="pullquote">it comes with a significant bonus for plugin authors</span>.</p>
<p>In addition to its basic function, the code is designed to serve as a tutorial of sorts, showing authors how to use some very interesting plugin techniques, such as modifying <em>any</em> option on the fly as it is pulled from the options table, or how to modify sections of the core admin pages.</p>
<p>It&#8217;s worth a look, and thanks to Otto for sharing.</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/08/more-than-a-mere-wordpress-plugin-automatic-timezone/">Permalink to More than a mere WordPress plugin &#8212; Automatic Timezone</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/08/more-than-a-mere-wordpress-plugin-automatic-timezone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

