<?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>DJS Consulting Tech Blog &#187; WordPress</title>
	<atom:link href="http://djs-consulting.com/linux/blog/category/programming/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://djs-consulting.com/linux/blog</link>
	<description>Technical Information You Can Use (or not - but hey, at least it&#039;s free!)</description>
	<lastBuildDate>Tue, 02 Mar 2010 19:11:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Daniel&#8217;s DropDowns 2.1 &#8211; WordPress Plug-In</title>
		<link>http://djs-consulting.com/linux/blog/2008/daniels-dropdowns-21-wordpress-plug-in</link>
		<comments>http://djs-consulting.com/linux/blog/2008/daniels-dropdowns-21-wordpress-plug-in#comments</comments>
		<pubDate>Sat, 10 May 2008 02:14:39 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Plug-Ins]]></category>

		<guid isPermaLink="false">http://www.djs-consulting.com/linux/blog/?p=64</guid>
		<description><![CDATA[Version 2.1 of Daniel&#8217;s DropDowns has been released.  This fixes a problem introduced with the 2.5-series of WordPress &#8211; the output of the WordPress tag changed, so the search-and-replace portion that added a &#8220;Select Category&#8221; entry didn&#8217;t work.  This has been fixed in version 2.1.  I also corrected a small bug that [...]]]></description>
			<content:encoded><![CDATA[<p>Version 2.1 of Daniel&#8217;s DropDowns has been released.  This fixes a problem introduced with the 2.5-series of WordPress &#8211; the output of the WordPress tag changed, so the search-and-replace portion that added a &#8220;Select Category&#8221; entry didn&#8217;t work.  This has been fixed in version 2.1.  I also corrected a small bug that caused the first entry in the category list to be selected if a default wasn&#8217;t specified.</p>
<p>It can be downloaded from the <a href="http://wordpress.org/extend/plugins/daniels-dropdowns/">WordPress Plug-In Directory</a>.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://djs-consulting.com/linux/blog/2008/daniels-dropdowns-21-wordpress-plug-in/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>HCSB Verse of the Day 2 &#8211; WordPress Plug-In</title>
		<link>http://djs-consulting.com/linux/blog/2008/hcsb-verse-of-the-day-2-wordpress-plug-in</link>
		<comments>http://djs-consulting.com/linux/blog/2008/hcsb-verse-of-the-day-2-wordpress-plug-in#comments</comments>
		<pubDate>Tue, 01 Jan 2008 18:02:14 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Plug-Ins]]></category>
		<category><![CDATA[bible]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plug-in]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.djs-consulting.com/linux/blog/2008/hcsb-verse-of-the-day-2-wordpress-plug-in</guid>
		<description><![CDATA[I have released version 2 of HCSB Verse of the Day, the WordPress plug-in that provides a verse or passage each day, using the reference provided by BibleGateway.com.  I also completed the required files for the WordPress Plug-In Directory, so it can be downloaded from there.
New in this version..

New Tag &#8211; There is now [...]]]></description>
			<content:encoded><![CDATA[<p>I have released version 2 of HCSB Verse of the Day, the <a href="http://wordpress.org" title="WordPress">WordPress</a> plug-in that provides a verse or passage each day, using the reference provided by <a href="http://www.biblegateway.com" title="Bible Gateway">BibleGateway.com</a>.  I also completed the required files for the WordPress Plug-In Directory, so it can be <a href="http://wordpress.org/extend/plugins/hcsb-verse-of-the-day/" title="Download HCSB Verse of the Day 2">downloaded from there</a>.</p>
<p>New in this version..</p>
<ul>
<li><strong>New Tag</strong> &#8211; There is now a tag votd_hcsb() that puts out the heading, the text, the reference, and the credit line all in one.  This will simplify the template modification required to implement the plug-in.</li>
<li><strong>Custom Tag</strong> &#8211; There is a separate file where you can specify a separate group of tags, and the votd_hcsb() tag will utilize it instead of its default.  This also means that, even if future versions change the default, the custom tag layout will be used.</li>
<li><strong>Two Versions</strong> &#8211; WordPress (and most plug-ins) must be compatible with PHP version 4.  However, if your web server is running PHP version 5, there is now a PHP 5 version included.  It incorporates the object-oriented enhancements in PHP 5.</li>
<li><strong>Options Revamped</strong> &#8211; Since I initially wrote the plug-in, I&#8217;ve learned that WordPress allows an option to be an array.  So, to streamline its usage, the options are now an array, and only require one row in the database instead of five.  There is also a file to clean up the old options.</li>
<li><strong>Bug Fixes</strong> &#8211; BibleGateway.com changed the way they display multiple passages (ex. &#8220;Matthew 1:13, 17-19&#8243;); version 2 has a fix that makes that work again.</li>
</ul>
<p>As always, if you encounter any problems with the plug-in, just let me know and I&#8217;ll try to help.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://djs-consulting.com/linux/blog/2008/hcsb-verse-of-the-day-2-wordpress-plug-in/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Daniel&#8217;s DropDowns 2.0.1 &#8211; WordPress Plug-In</title>
		<link>http://djs-consulting.com/linux/blog/2007/daniels-dropdowns-201-wordpress-plug-in</link>
		<comments>http://djs-consulting.com/linux/blog/2007/daniels-dropdowns-201-wordpress-plug-in#comments</comments>
		<pubDate>Mon, 24 Dec 2007 17:34:06 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Plug-Ins]]></category>

		<guid isPermaLink="false">http://www.djs-consulting.com/linux/blog/2007/daniels-dropdowns-201-wordpress-plug-in</guid>
		<description><![CDATA[I have released version 2.0.1 of Daniel&#8217;s DropDowns, the WordPress plug-in that provides category and archive dropdown template tags.  It is available on its page at the WordPress Plug-In Directory.
This was a minor change &#8211; the auto-navigating lists added in version 2 needed a slight tweak.  There wasn&#8217;t a &#8220;select category&#8221; entry, so [...]]]></description>
			<content:encoded><![CDATA[<p>I have released version 2.0.1 of Daniel&#8217;s DropDowns, the <a href="http://wordpress.org">WordPress</a> plug-in that provides category and archive dropdown template tags.  It is available on <a href="http://wordpress.org/extend/plugins/daniels-dropdowns/" title="Download Daniel's DropDowns 2.0.1">its page at the WordPress Plug-In Directory</a>.</p>
<p>This was a minor change &#8211; the auto-navigating lists added in version 2 needed a slight tweak.  There wasn&#8217;t a &#8220;select category&#8221; entry, so one could not navigate to the first item in the list without going somewhere else first.  The category dropdown now has this entry, and is consistent with the archive dropdown.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://djs-consulting.com/linux/blog/2007/daniels-dropdowns-201-wordpress-plug-in/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Daniel&#8217;s DropDowns 2 &#8211; WordPress Plug-In</title>
		<link>http://djs-consulting.com/linux/blog/2007/daniels-dropdowns-2-wordpress-plug-in</link>
		<comments>http://djs-consulting.com/linux/blog/2007/daniels-dropdowns-2-wordpress-plug-in#comments</comments>
		<pubDate>Mon, 24 Dec 2007 06:02:19 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Plug-Ins]]></category>

		<guid isPermaLink="false">http://www.djs-consulting.com/linux/blog/2007/daniels-dropdowns-2-wordpress-plug-in</guid>
		<description><![CDATA[I have released version 2 of my category and archive drop-down plug-in for WordPress.  It is hosted at the WordPress Plug-In Directory &#8211; you can go get it there.  Following are a few of the changes that were made.

Both tags now have only 2 parameters &#8211; the type of navigation and the text [...]]]></description>
			<content:encoded><![CDATA[<p>I have released version 2 of my category and archive drop-down plug-in for <a href="http://wordpress.org" title="WordPress">WordPress</a>.  It is hosted at the WordPress Plug-In Directory &#8211; you can <a href="http://wordpress.org/extend/plugins/daniels-dropdowns/" title="Download Daniel's DropDowns 2">go get it there</a>.  Following are a few of the changes that were made.</p>
<ul>
<li>Both tags now have only 2 parameters &#8211; the type of navigation and the text for the link or button.  For navigation type, &#8216;button&#8217; remains the default, and &#8216;link&#8217; is still available.  However, a third option of &#8216;auto&#8217; has been added, which will render the list as an auto-navigating select box.</li>
<li>The CSS parameters for the select and button elements were dropped.  How these elements can be specified using CSS is detail in the top-of-plugin comments, along with an example.</li>
<li>The usage examples in the comments now have an example of how to put the tag in a template in such a way that, if the plug-in is disabled, the template will still render.  This could be done with 1.0, but I didn&#8217;t give an example.</li>
<li>I added PHP Documentor-style comments to both functions.</li>
</ul>
<p>Let me know if you have any problems with it, or any ideas for other behavior.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://djs-consulting.com/linux/blog/2007/daniels-dropdowns-2-wordpress-plug-in/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Tags to a WordPress Theme</title>
		<link>http://djs-consulting.com/linux/blog/2007/adding-tags-to-a-wordpress-theme</link>
		<comments>http://djs-consulting.com/linux/blog/2007/adding-tags-to-a-wordpress-theme#comments</comments>
		<pubDate>Mon, 26 Nov 2007 05:47:11 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.djs-consulting.com/linux/blog/2007/adding-tags-to-a-wordpress-theme</guid>
		<description><![CDATA[WordPress 2.3 introduced tags, but unless you&#8217;re using the default theme, your theme (like mine) probably didn&#8217;t support them.  Nowhere did I find a good example of how to add tags to your theme.  Then, I was playing around with the theme switcher on my personal blog, and discovered that the default theme [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress 2.3 introduced tags, but unless you&#8217;re using the default theme, your theme (like mine) probably didn&#8217;t support them.  Nowhere did I find a good example of how to add tags to your theme.  Then, I was playing around with the theme switcher on my personal blog, and discovered that the default theme had tag support.  I looked at it, and it was amazingly simple.</p>
<p>There is a new template tag called &#8230;drumroll&#8230;  the_tags.  It takes three parameters: how to begin the list, how to separate each tag, and how to end the list.  The tag does not do any output if a post hasn&#8217;t been tagged, so it can safely sit in your theme until you need it to be active.</p>
<p>Here&#8217;s how I did it in my personal blog.  (Tags will appear on this blog shortly.)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_tags<span style="color: #009900;">&#40;</span><span style="">'&lt;div class=&quot;tags&quot;&gt;Tags &amp;raquo; '</span><span style="color: #339933;">,</span> <span style="">' &amp;bull; '</span><span style="color: #339933;">,</span> <span style="">'&lt;/div&gt;'</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Of course, you could also do it using an unordered list&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_tags<span style="color: #009900;">&#40;</span><span style="">'Tags&lt;ul class=&quot;tags&quot;&gt;&lt;li&gt;'</span><span style="color: #339933;">,</span> <span style="">'&lt;/li&gt;&lt;li&gt;'</span><span style="color: #339933;">,</span> <span style="">'&lt;/li&gt;&lt;/ul&gt;'</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Drop some styling for the &#8220;tags&#8221; class in your theme&#8217;s CSS, and you&#8217;re good to go!</p>
<p>(Well, not quite.  You&#8217;ll want to make sure to make the same change in your main index template, single post template, and archive template, so that the tags appear no matter how the user got to the post.)</p>
]]></content:encoded>
			<wfw:commentRss>http://djs-consulting.com/linux/blog/2007/adding-tags-to-a-wordpress-theme/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Daniel&#8217;s DropDowns 1.0 &#8211; WordPress Plug-In</title>
		<link>http://djs-consulting.com/linux/blog/2007/daniels-dropdowns-10-wordpress-plug-in</link>
		<comments>http://djs-consulting.com/linux/blog/2007/daniels-dropdowns-10-wordpress-plug-in#comments</comments>
		<pubDate>Wed, 03 Oct 2007 01:54:26 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Plug-Ins]]></category>

		<guid isPermaLink="false">http://www.djs-consulting.com/linux/blog/2007/daniels-dropdowns-10-wordpress-plug-in</guid>
		<description><![CDATA[I&#8217;ve created a plug-in that I&#8217;m now using on my personal site to provide the category and archive drop-down lists.  It&#8217;s called &#8220;Daniel&#8217;s DropDowns&#8221;, and it will create drop-downs with either a link or a button to go to the selection in the drop-down, and a CSS class can be specified for the button [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve created a plug-in that I&#8217;m now using on my personal site to provide the category and archive drop-down lists.  It&#8217;s called &#8220;Daniel&#8217;s DropDowns&#8221;, and it will create drop-downs with either a link or a button to go to the selection in the drop-down, and a CSS class can be specified for the button and the drop-down box.</p>
<p><a href="http://www.djs-consulting.com/linux/daniels_dropdowns.txt" title="Click to Download Daniel's DropDowns 1.0">daniels_dropdowns.txt</a> &#8211; Daniel&#8217;s DropDowns 1.0</p>
<p>To install it, download the file, rename it &#8220;daniels_dropdowns.php&#8221;, and upload it to your /wp-content/plugins directory.  Then, enable it, and add the template tags to your theme.  (The documentation at the top of the file lists all the template tags provided, and the options that can be passed to them.)</p>
]]></content:encoded>
			<wfw:commentRss>http://djs-consulting.com/linux/blog/2007/daniels-dropdowns-10-wordpress-plug-in/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>HCSB Verse of the Day 1.0 &#8211; WordPress Plug-In</title>
		<link>http://djs-consulting.com/linux/blog/2007/hcsb-verse-of-the-day-10-wordpress-plug-in</link>
		<comments>http://djs-consulting.com/linux/blog/2007/hcsb-verse-of-the-day-10-wordpress-plug-in#comments</comments>
		<pubDate>Wed, 26 Sep 2007 04:08:23 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Plug-Ins]]></category>

		<guid isPermaLink="false">http://www.djs-consulting.com/linux/blog/2007/hcsb-verse-of-the-day-10-wordpress-plug-in</guid>
		<description><![CDATA[I have used a hack in the theme of my personal site for a while to obtain the &#8220;Verse of the Day&#8221; in the Holman Christian Standard Bible (HCSB) version.  With things that I&#8217;ve learned about plug-ins, I decided to take a stab at creating a plug-in to do this work.  That way, [...]]]></description>
			<content:encoded><![CDATA[<p>I have used a hack in the theme of my personal site for a while to obtain the &#8220;Verse of the Day&#8221; in the Holman Christian Standard Bible (HCSB) version.  With things that I&#8217;ve learned about plug-ins, I decided to take a stab at creating a plug-in to do this work.  That way, if I changed themes, I wouldn&#8217;t have to hack the new one they way I&#8217;ve hacked the current one.</p>
<p>The fruits of my labor is the new HCSB Verse of the Day plug-in for WordPress.  It uses the reference from <a href="http://www.biblegateway.com" title="Bible Gateway">BibleGateway.com</a>, then gets the text from their regular website.  (They do not provide the service, citing copyright restrictions.)  How to use the plug-in, along with my justification on copyright grounds, is in the top of the file&#8217;s comments.  If they&#8217;re not clear, certainly post comments here and I&#8217;ll address them.  (I do plan to submit the plug-in to <a href="http://wordpress.org" title="WordPress">WordPress.org</a> &#8211; but, they require a specific README file format that it will take me a bit to put together.)</p>
<p><a href="/linux/votd_hcsb.txt" title="Click to download HCSB Verse of the Day 1.0">votd_hcsb.txt</a> &mdash; HCSB Verse of the Day 1.0</p>
<p>To install it, download the file, rename it &#8220;votd_hcsb.php&#8221;, and upload it to your /wp-content/plugins directory.  Then, enable it, and add the template tags to your theme &#8211; that&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://djs-consulting.com/linux/blog/2007/hcsb-verse-of-the-day-10-wordpress-plug-in/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress 2.3 About to Drop</title>
		<link>http://djs-consulting.com/linux/blog/2007/wordpress-23-about-to-drop</link>
		<comments>http://djs-consulting.com/linux/blog/2007/wordpress-23-about-to-drop#comments</comments>
		<pubDate>Mon, 24 Sep 2007 19:05:50 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[General Info]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.djs-consulting.com/linux/blog/2007/wordpress-23-about-to-drop</guid>
		<description><![CDATA[Version 2.3 of WordPress, the blogging software I use to produce this blog (as well as the other blogs on my site), will be released later today.  I&#8217;ll be upgrading these blogs on Monday evening.  There have been major pieces of WordPress that have been re-worked, and those are causing some plug-ins to [...]]]></description>
			<content:encoded><![CDATA[<p>Version 2.3 of WordPress, the blogging software I use to produce this blog (as well as the other blogs on my site), will be released later today.  I&#8217;ll be upgrading these blogs on Monday evening.  There have been major pieces of WordPress that have been re-worked, and those are causing some plug-ins to not work correctly.  None of my blogs are all that reliant on plug-ins &#8211; the &#8220;Share This&#8221; plug-in is the main one, and it&#8217;s been verified in 2.3 already.</p>
<p>There&#8217;s lots more information on the <a href="http://wordpress.org/development" title="Development Blog - WordPress.org">WordPress Development Blog</a> &#8211; I won&#8217;t go into the details here.  I&#8217;m confident this will be a smooth upgrade.  I just wanted to let you know in case some things look strange, I&#8217;m on it.</p>
]]></content:encoded>
			<wfw:commentRss>http://djs-consulting.com/linux/blog/2007/wordpress-23-about-to-drop/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Incorporating an Akismet Counter Into a WordPress Theme</title>
		<link>http://djs-consulting.com/linux/blog/2007/incorporating-an-akismet-counter-into-a-wordpress-theme</link>
		<comments>http://djs-consulting.com/linux/blog/2007/incorporating-an-akismet-counter-into-a-wordpress-theme#comments</comments>
		<pubDate>Mon, 06 Aug 2007 16:14:57 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.djs-consulting.com/linux/blog/2007/incorporating-an-akismet-counter-into-a-wordpress-theme</guid>
		<description><![CDATA[Akismet is, by far, the most popular anti-spam plug-in for WordPress.  (It comes bundled with the download, so that gets it market share.  But, it&#8217;s also very, very good.)  It comes with a counter that can be put into a WordPress theme.  It&#8217;s attractive, but its light blue color may not [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://akismet.com" title="Akismet">Akismet</a> is, by far, the most popular anti-spam plug-in for WordPress.  (It comes bundled with the download, so that gets it market share.  But, it&#8217;s also very, very good.)  It comes with a counter that can be put into a WordPress theme.  It&#8217;s attractive, but its light blue color may not integrate well into a given theme.</p>
<p>I went digging around in the source code, and found the line that actually pulls the count from the database.  Using this parameter, I was able to integrate a spam count into the sidebar that has a look consistent with the rest of the site.</p>
<p>Here&#8217;s the code that&#8217;s in use on the theme on this site.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;">&lt;li id=&quot;spamstats&quot;&gt;
	&lt;h2&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="">'Akismet-Eaten Spam:'</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h2&gt;
	&lt;ul&gt;
		&lt;li&gt;&lt;a href=&quot;http://akismet.com&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span>
			<span style="color: #990000;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">number_format</span><span style="color: #009900;">&#40;</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;akismet_spam_count&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span>
			and counting...&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
&lt;/li&gt;</pre></td></tr></table></div>

<p>Of course, line 5 is the important one &#8211; that&#8217;s how to get the number, formatted for whatever locale the server is set up for.  (On my <a href="http://daniel.summershome.org" title="Daniel J. Summers">personal blog</a>, the number is up over 1,400!)</p>
]]></content:encoded>
			<wfw:commentRss>http://djs-consulting.com/linux/blog/2007/incorporating-an-akismet-counter-into-a-wordpress-theme/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Posting Source Code in WordPress, Take 2</title>
		<link>http://djs-consulting.com/linux/blog/2007/posting-source-code-in-wordpress-take-2</link>
		<comments>http://djs-consulting.com/linux/blog/2007/posting-source-code-in-wordpress-take-2#comments</comments>
		<pubDate>Wed, 13 Jun 2007 17:33:51 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.djs-consulting.com/linux/blog/2007/posting-source-code-in-wordpress-take-2</guid>
		<description><![CDATA[In my searching, I have found another WordPress source code plugin, called wp-syntax.  This one uses GeSHi, the Generic Syntax Highlighter.  It features many languages, and is extensible to even more.  (If I ever post a COBOL snippet, I&#8217;ll probably add COBOL support to it, and contribute it to the codebase.)
To use [...]]]></description>
			<content:encoded><![CDATA[<p>In my searching, I have found another WordPress source code plugin, called <a href="http://wordpress.org/extend/plugins/wp-syntax/" title="WP Syntax Plugin">wp-syntax</a>.  This one uses <a href="http://qbnz.com/highlighter/" title="GeSHi">GeSHi</a>, the Generic Syntax Highlighter.  It features many languages, and is extensible to even more.  (If I ever post a COBOL snippet, I&#8217;ll probably add COBOL support to it, and contribute it to the codebase.)</p>
<p>To use it, you simply put a pre tag, followed by &#8220;lang=[language]&#8220;.  It will also do line numbering.  Of course, with a single &#8220;language&#8221; parameter, the embedded language will not be highlighted as well.  In this case, the previous plug-in works better; although the syntax highlighting has to be done manually, it can handle multiple languages.</p>
<p>Here is what the example from the &#8220;Category DropDowns in WordPress&#8221; post looks like with <code class="inline" style="padding:0;">lang="php"</code>&hellip;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #0000ff; font-style: italic;">/**
* This creates a list of category links that can be used with a category dropdown
*/</span>
<span style="color: #000088;">$aCategories</span> <span style="color: #339933;">=</span> get_all_category_ids<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #000088;">$iMaxCat</span> <span style="color: #339933;">=</span> <span style="color:#800080;">0</span>;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$aCategories</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$iThisCat</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$iMaxCat</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$iThisCat</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$iMaxCat</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$iThisCat</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$iMaxCat</span>++;
<span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;div style=&quot;text-align:center;&quot;&gt;
    &lt;form name=&quot;categoryform&quot; action=&quot;&quot; style=&quot;text-align:center;&quot;&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
        var aLink = new Array(<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$iMaxCat</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span>);
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$aCategories</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$iThisCat</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;aLink[$iThisCat] = <span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> get_category_link<span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$iThisCat</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        function goCat() {
            window.location =
                aLink[document.getElementById('cat')[document.getElementById('cat').selectedIndex].value];
        }
    &lt;/script&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_dropdown_categories<span style="color: #009900;">&#40;</span><span style="">'class=sidebardropdown&amp;orderby=name&amp;show_count=1&amp;hierarchical=1'</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;br /&gt;
    &lt;button class=&quot;sidebarbutton&quot; type=&quot;button&quot; style=&quot;margin-top:5px;&quot; onclick=&quot;goCat();&quot;&gt;View Category&lt;/button&gt;
    &lt;/form&gt;
&lt;/div&gt;</pre></td></tr></table></div>

<p>And, here&#8217;s what it looks like with <code class="inline" style="padding:0;">lang="javascript"</code>&hellip;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;">&lt;?php
/**
* This creates a list of category links that can be used with a category dropdown
*/
$aCategories = get_all_category_ids();
$iMaxCat = 0;
foreach($aCategories as $iThisCat) {
    if ($iMaxCat &lt; $iThisCat) {
        $iMaxCat = $iThisCat;
    }
}
$iMaxCat++;
?&gt;&lt;div style=&quot;text-align:center;&quot;&gt;
    &lt;form name=&quot;categoryform&quot; action=&quot;&quot; style=&quot;text-align:center;&quot;&gt;
    <span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
        <span style="color: #003366; font-weight: bold;">var</span> aLink <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #339933;">&lt;?</span>php echo<span style="color: #009900;">&#40;</span>$iMaxCat<span style="color: #009900;">&#41;</span>; <span style="color: #339933;">?&gt;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #339933;">&lt;?</span>php
foreach<span style="color: #009900;">&#40;</span>$aCategories <span style="color: #000066; font-weight: bold;">as</span> $iThisCat<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    echo<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;aLink[$iThisCat] = <span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> . <span style="color: #660066;">get_category_link</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span>$iThisCat<span style="color: #009900;">&#41;</span> . <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span> <span style="color: #339933;">?&gt;</span>
        <span style="color: #003366; font-weight: bold;">function</span> goCat<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            window.<span style="color: #660066;">location</span> <span style="color: #339933;">=</span>
                aLink<span style="color: #009900;">&#91;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cat'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cat'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">selectedIndex</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">value</span><span style="color: #009900;">&#93;</span>;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
    &lt;?php wp_dropdown_categories('class=sidebardropdown&amp;orderby=name&amp;show_count=1&amp;hierarchical=1'); ?&gt;
    &lt;br /&gt;
    &lt;button class=&quot;sidebarbutton&quot; type=&quot;button&quot; style=&quot;margin-top:5px;&quot; onclick=&quot;goCat();&quot;&gt;View Category&lt;/button&gt;
    &lt;/form&gt;
&lt;/div&gt;</pre></td></tr></table></div>

<p>This is another option, and is probably what I&#8217;ll use for single-language posts, or posts where the embedded language may not be crucial.</p>
]]></content:encoded>
			<wfw:commentRss>http://djs-consulting.com/linux/blog/2007/posting-source-code-in-wordpress-take-2/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
