<?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>Michael Fields &#187; Plugin Development</title>
	<atom:link href="http://wordpress.mfields.org/topics/plugin-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://wordpress.mfields.org</link>
	<description>I&#039;m a Theme Wrangler at Automattic! Rock!</description>
	<lastBuildDate>Tue, 27 Mar 2012 20:37:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Re-key an Indexed Array of Post Objects by Post ID</title>
		<link>http://wordpress.mfields.org/2011/rekey-an-indexed-array-of-post-objects-by-post-id/</link>
		<comments>http://wordpress.mfields.org/2011/rekey-an-indexed-array-of-post-objects-by-post-id/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 15:18:40 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://wordpress.mfields.org/?p=498</guid>
		<description><![CDATA[Ever need to know if a certain post was contained in an array returned by get_posts() or get_pages()?. Me too! Usually, I would manually loop over the array and do a bit of discovery. I recently came up with a new trick to re-key post arrays that is a bit cleaner. If you run something]]></description>
			<content:encoded><![CDATA[<p>Ever need to know if a certain post was contained in an array returned by <code>get_posts()</code> or <code>get_pages()</code>?. Me too! Usually, I would manually loop over the array and do a bit of discovery. I recently came up with a new trick to re-key post arrays that is a bit cleaner.</p>
<p><span id="more-498"></span></p>
<p>If you run something like:</p>
<pre class="brush: php; title: ; notranslate">
$pages = get_pages();
print '&lt;pre&gt;' . print_r( $pages, true ) . '&lt;/pre&gt;';
</pre>
<p>&#8230; something similar to the following will be printed to the screen <em>(example truncated for brevity)</em>:</p>
<pre>
[0] => stdClass Object
	[ID] => 675
	[post_author] => 5
	[post_date] => 2010-07-25 19:40:01
	[post_date_gmt] => 2010-07-25 19:40:01
	[post_content] => This site is using the standard ...
	[post_title] => About The Tests

[1] => stdClass Object
	[ID] => 501
	[post_author] => 6
	[post_date] => 2010-08-01 09:42:26
	[post_date_gmt] => 2010-08-01 16:42:26
	[post_content] => The last item in this page's content  ...
	[post_title] => Clearing Floats

[2] => stdClass Object
	[ID] => 174
	[post_author] => 5
	[post_date] => 2007-12-11 16:25:40
	[post_date_gmt] => 2007-12-11 06:25:40
	[post_content] => Level 1 of the reverse hierarchy test ...
	[post_title] => Level 1
	)

[3] => stdClass Object
	[ID] => 173
	[post_author] => 5
	[post_date] => 2007-12-11 16:23:33
	[post_date_gmt] => 2007-12-11 06:23:33
	[post_content] => Level 2 of the reverse hierarchy test.
	[post_title] => Level 2
</pre>
<p>Both <code>get_posts()</code> and <code>get_pages()</code> will return an indexed array of post objects. The keys in these arrays reflect the order in which the posts were returned from the database. I have always preferred the way that <code>get_children()</code> returns it results. It too returns an indexed array of post objects, however the array is indexed by post id. This is very helpful in many contexts.</p>
<p>I&#8217;ve recently discovered the not-so-new WordPress core function <code>wp_list_pluck()</code>. With the help of this function, I was able to come up with the following few lines to re-key the arrays returned by <code>get_posts()</code> and <code>get_pages()</code>.</p>
<pre class="brush: php; title: ; notranslate">
$pages = get_pages();
if ( ! empty( $pages ) ) {
	$ids   = wp_list_pluck( $pages, 'ID' );
	$pages = array_combine( $ids, $pages );
}
</pre>
<p>Now you get something a bit easier to work with:</p>
<pre>
[675] => stdClass Object
	[ID] => 675
	[post_author] => 5
	[post_date] => 2010-07-25 19:40:01
	[post_date_gmt] => 2010-07-25 19:40:01
	[post_content] => This site is using the standard ...
	[post_title] => About The Tests

[501] => stdClass Object
	[ID] => 501
	[post_author] => 6
	[post_date] => 2010-08-01 09:42:26
	[post_date_gmt] => 2010-08-01 16:42:26
	[post_content] => The last item in this page's content  ...
	[post_title] => Clearing Floats

[174] => stdClass Object
	[ID] => 174
	[post_author] => 5
	[post_date] => 2007-12-11 16:25:40
	[post_date_gmt] => 2007-12-11 06:25:40
	[post_content] => Level 1 of the reverse hierarchy test ...
	[post_title] => Level 1
	)

[173] => stdClass Object
	[ID] => 173
	[post_author] => 5
	[post_date] => 2007-12-11 16:23:33
	[post_date_gmt] => 2007-12-11 06:23:33
	[post_content] => Level 2 of the reverse hierarchy test.
	[post_title] => Level 2
</pre>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/2011/rekey-an-indexed-array-of-post-objects-by-post-id/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Taxonomy Images Plugin &#8211; Moving Forward</title>
		<link>http://wordpress.mfields.org/2011/taxonomy-images-plugin-moving-forward/</link>
		<comments>http://wordpress.mfields.org/2011/taxonomy-images-plugin-moving-forward/#comments</comments>
		<pubDate>Sat, 21 May 2011 12:40:53 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
				<category><![CDATA[Questions]]></category>

		<guid isPermaLink="false">http://wordpress.mfields.org/?p=438</guid>
		<description><![CDATA[Development on the next version of the Taxonomy Images plugin is underway. I&#8217;ve completely rewritten the plugin taking many things into consideration. But I would like to get your feedback on how you use this plugin. Associating images to terms of taxonomies is a rather straight forward thing. What users actually do with these associations]]></description>
			<content:encoded><![CDATA[<p>Development on the next version of the Taxonomy Images plugin is underway. I&#8217;ve completely rewritten the plugin taking many things into consideration. But I would like to get your feedback on how you use this plugin. Associating images to terms of taxonomies is a rather straight forward thing. What users actually do with these associations is another thing all together!</p>
<p><span id="more-438"></span></p>
<p><a class="button github" href="https://github.com/mfields/Taxonomy-Images">Check out the progress! <span>Hosted by Github</span></a></p>
<h2>What I use it for</h2>
<p>The reason I originally made the plugin was to associate images with each <a href="http://art.mfields.org/symbolism/">symbol</a> in my art portfolio. <em>Symbol</em> is a custom taxonomy that I use to organize the different drawings and paintings. I felt that it was easier to show visitors what the symbol looked like rather than just rely on text. So I created the Taxonomy Images plugin to provide this functionality. </p>
<p>What I have realized is that my application of this plugin may or may not apply to how others use it or expect it to work. There have been many questions about how to accomplish certain tasks that are outside the scope of functionality provided in past versions. One of the goals in version 0.7 is to provide as many low level functions to allow easy access to the associations create by this plugin.</p>
<h2>What You Can Do to Help</h2>
<p>Basically, I would like to know/see how you are using the plugin. And perhaps answer a few of the following questions. Any help is greatly appreciated! FYI, this plugin is free and released under the GPLv2.</p>
<p>Please leave a comment on this post or feel free to contact me directly. The information is on my <a href="http://wordpress.mfields.org/about/">about</a> page.</p>
<h2>A Few Questions</h2>
<ul>
<li>How do you use term images in your theme?</li>
<li>What taxonomies do you images with?</li>
<li>Can you answer <a href="http://wordpress.stackexchange.com/questions/17868/attachments-terms-queries-and-caching-oh-my">this question</a>?</li>
<li>What limitations have you found with the current version (0.5)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/2011/taxonomy-images-plugin-moving-forward/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>ArtPress Development is Now Public</title>
		<link>http://wordpress.mfields.org/2011/artpress-development-is-now-public/</link>
		<comments>http://wordpress.mfields.org/2011/artpress-development-is-now-public/#comments</comments>
		<pubDate>Sat, 29 Jan 2011 07:44:23 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://wordpress.mfields.org/?p=379</guid>
		<description><![CDATA[I&#8217;ve taken a break from this plugin for quite a while now and now it&#8217;s time to revisit it and, for lack of a better way to express it, get &#8216;er done. This is one of my first steps into custom post_types in WordPress 3.0 and there&#8217;s definitely some wonky stuff going on inside. The]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve taken a break from this plugin for quite a while now and now it&#8217;s time to revisit it and, for lack of a better way to express it, <em>get &#8216;er done</em>. This is one of my first steps into custom post_types in WordPress 3.0 and there&#8217;s definitely some wonky stuff going on inside. <span id="more-379"></span></p>
<p>The code is available on <a href="https://github.com/mfields/artpress">GitHub</a>. Would love to hear anyone&#8217;s thoughts on anything regarding it. It&#8217;s not exactly stable so I would not suggest using it on production sites as of yet, but it&#8217;s totally possible. There is so much that needs to be done, but I feel like I finally have a plan which starts with:</p>
<p><big>Delete almost everything!</big></p>
<p>I&#8217;ll be stripping away a lot of the half-baked functionality currently included within the plugin. Hopefully simplification will help me to actually finish it.</p>
<p>Here&#8217;s a short screencast highlighting some of the functionality:</p>
<p><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0' width='560' height='345'><param name='movie' value='http://screenr.com/Content/assets/screenr_1116090935.swf' /><param name='flashvars' value='i=90506' /><param name='allowFullScreen' value='true' /><embed src='http://screenr.com/Content/assets/screenr_1116090935.swf' flashvars='i=90506' allowFullScreen='true' width='560' height='345' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/2011/artpress-development-is-now-public/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Taxonomy Images 0.6 Release Candidate</title>
		<link>http://wordpress.mfields.org/2010/taxonomy-images-0-6-release-candidate/</link>
		<comments>http://wordpress.mfields.org/2010/taxonomy-images-0-6-release-candidate/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 17:19:32 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://wordpress.mfields.org/?p=354</guid>
		<description><![CDATA[Version 0.6 was never actually released, so I&#8217;ve removed all of the content from this page in hopes that users will not be misled by false information. Version 0.7 is available and fixes most of the issues slated for 0.6 as well as many, many more. Check it out! wordpress.org &#8211; github.com]]></description>
			<content:encoded><![CDATA[<div class="dialog notice">Version 0.6 was never actually released, so I&#8217;ve removed all of the content from this page in hopes that users will not be misled by false information. Version 0.7 is available and fixes most of the issues slated for 0.6 as well as many, many more. Check it out! <a href="http://wordpress.org/extend/plugins/taxonomy-images/">wordpress.org</a> &#8211; <a href="https://github.com/mfields/Taxonomy-Images">github.com</a></div>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/2010/taxonomy-images-0-6-release-candidate/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Taxonomy Images 0.6 Snippets</title>
		<link>http://wordpress.mfields.org/2010/taxonomy-images-0-6-snippets/</link>
		<comments>http://wordpress.mfields.org/2010/taxonomy-images-0-6-snippets/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 10:44:53 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://wordpress.mfields.org/?p=351</guid>
		<description><![CDATA[Here are a bunch of examples about how you can customize the display of the Taxonomy Images plugin. It has been completely rewritten and there are many filters that you can use in your theme to make it look just right. If you are not familiar with this plugin, please head on over to the]]></description>
			<content:encoded><![CDATA[<p>Here are a bunch of examples about how you can customize the display of the Taxonomy Images plugin. It has been completely rewritten and there are many filters that you can use in your theme to make it look just right. <span id="more-351"></span></p>
<p>If you are not familiar with this plugin, please head on over to the WordPress Plugin Directory and check it out.</p>
<p><!--a href="http://wordpress.org/extend/plugins/taxonomy-images/" class="button">Download 0.6 RC1</a--></p>
<h2>Custom Filters</h2>
<p>The following snippets pertain to the <code>taxonomy_image_plugin_image_list()</code> action as well as the function of the same name. You can place these filters in your theme&#8217;s <a href="http://codex.wordpress.org/Theme_Development#Functions_File">functions file</a>.</p>
<h3>Use <em>div</em> instead of the default <em>ul</em> tag for all taxonomy lists.</h3>
<pre class="brush: php; title: ; notranslate">
/**
 * Change the &quot;ul&quot; element in taxonomy_image_plugin_image_list()
 * to &quot;div&quot; for all taxonomy lists.
 */
function mytheme_taxonomy_image_plugin_list_element() {
	return 'div';
}
add_filter( 'taxonomy_image_plugin_list_element', 'mytheme_taxonomy_image_plugin_list_element' );</pre>
<p>This simple filter allows you to change the name of the html element used to wrap the generated list of images. The following values can be used in such a filter: <em>ol</em>, <em>ul</em>, <em>p</em>, <em>div</em>. If any other value is passed, the default value of <em>ul</em> will be used.</p>
<h3>Use <em>p</em> instead of <em>ul</em> for tags only.</h3>
<pre class="brush: php; title: ; notranslate">
/**
 * Change the &quot;ul&quot; tags in taxonomy_image_plugin_image_list()
 * to &quot;p&quot; tags for the &quot;post_tag&quot; taxonomy only.
 */
function mytheme_taxonomy_image_plugin_list_element_post_tag() {
	return 'p';
}
add_filter( 'taxonomy_image_plugin_list_element_post_tag', 'mytheme_taxonomy_image_plugin_list_element_post_tag' );
</pre>
<p>If have extended the filters to recognize individual taxonomies enabling each list to be filtered individually. In the above example, the <em>post_tag</em> taxonomy is singled out and its terms will now be wrapped in a paragraph. All other taxonomy lists will be left alone.</p>
<h3>Use <em>span</em> instead of <em>li</em> for all lists.</h3>
<pre class="brush: php; title: ; notranslate">
/**
 * Change the default &quot;li&quot; element in taxonomy_image_plugin_image_list()
 * to &quot;span&quot; for all taxonomy lists.
 */
function mytheme_taxonomy_image_plugin_list_item_element() {
	return 'span';
}
add_filter( 'taxonomy_image_plugin_list_item_element', 'mytheme_taxonomy_image_plugin_list_item_element' );
</pre>
<h3>Add a class of <em>thickbox</em> to all links in category lists.</h3>
<pre class="brush: php; title: ; notranslate">
/**
 * Add a class of &quot;thickbox&quot; to all linked images only in the category taxonomy.
 */
function mytheme_images_plugin_list_item_link_add_thickbox_class( $atts ) {
	$atts['class'] = 'thickbox';
	return $atts;
}
add_filter( 'taxonomy_image_plugin_list_item_link_atts_category', 'mytheme_images_plugin_list_item_link_add_thickbox_class' );
</pre>
<h3>Force all image links to open in a new browser window.</h3>
<pre class="brush: php; title: ; notranslate">
/**
 * Force all image links to open in a new browser window.
 */
function mytheme_images_plugin_list_item_link_add_target_blank( $atts ) {
	$atts['target'] = '_blank';
	return $atts;
}
add_filter( 'taxonomy_image_plugin_list_item_link_atts', 'mytheme_images_plugin_list_item_link_add_target_blank' );
</pre>
<h3>Remove the title attribute from all links.</h3>
<pre class="brush: php; title: ; notranslate">
/**
 * Remove the title attribute from all links.
 */
function mytheme_images_plugin_list_item_link_remove_title_attribute( $atts ) {
	unset( $atts['title'] );
	return $atts;
}
add_filter( 'taxonomy_image_plugin_list_item_link_atts', 'mytheme_images_plugin_list_item_link_remove_title_attribute' );
</pre>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/2010/taxonomy-images-0-6-snippets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Function Testing with Action Hooks</title>
		<link>http://wordpress.mfields.org/2010/function-testing-with-action-hooks/</link>
		<comments>http://wordpress.mfields.org/2010/function-testing-with-action-hooks/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 15:51:30 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://wordpress.mfields.org/?p=321</guid>
		<description><![CDATA[I found myself in a position where I needed to know how early I could use a set of custom conditional functions in my theme. All of the functions are defined during the after_setup_theme action, but were unavailable during init and wp_loaded. I came up with the following solution which will run the function during]]></description>
			<content:encoded><![CDATA[<p>I found myself in a position where I needed to know how early I could use a set of custom conditional functions in my theme. All of the functions are defined during the <code>after_setup_theme</code> action, but were unavailable during <code>init</code> and <code>wp_loaded</code>. I came up with the following solution which will run the function during most public-facing actions and append a report to the html document. <span id="more-321"></span></p>
<p>I was able to determine that all of the conditional functions I tested were available at <code>wp</code> and all points after. This allowed me to plan my project better.</p>
<h2>Unexpected Debuging Help</h2>
<p>As soon as I ran this code I noticed that there were a ton of notices generated during all hooks before <code>wp</code>. This prompted me to re-factor the functions. This was a nice bonus.</p>
<h2>The Code</h2>
<p>Place in your theme&#8217;s functions.php file. You will probable want to change the value of <var>$test</var>.</p>
<pre class="brush: php; title: ; notranslate">
/**
 * A list of WordPress actions.
 * From: http://codex.wordpress.org/Plugin_API/Action_Reference#Actions_Run_During_a_Typical_Request
 */
$actions = array ( 'muplugins_loaded', 'plugins_loaded', 'sanitize_comment_cookies', 'setup_theme', 'load_textdomain', 'after_setup_theme', 'auth_cookie_malformed', 'set_current_user', 'init', 'widgets_init', 'register_sidebar', 'wp_register_sidebar_widget', 'wp_loaded', 'parse_request', 'send_headers', 'pre_get_posts', 'posts_selection', 'wp', 'template_redirect', 'get_header', 'wp_head', 'wp_enqueue_scripts', 'wp_print_styles', 'wp_print_scripts', 'get_template_part_loop', 'loop_start', 'the_post', 'loop_end', 'get_sidebar', 'dynamic_sidebar', 'get_search_form', 'parse_query', 'wp_meta', 'get_footer', 'twentyten_credits', 'wp_footer', 'wp_print_footer_scripts', 'shutdown' );

/**
 * Register test function as a callback for each action.
 */
foreach( $actions as $action ) {
	add_action( $action, 'mfields_conditional_function_test' );
}
/**
 * Test function.
 */
function mfields_conditional_function_test() {

	/* The name of the function to test. */
	$test = 'artpress_is_piece';

	/* All results will be stored here. */
	static $results = array();

	/* Find the current action. */
	$action = (string) current_filter();

	/* Run the function and store the result. */
	$results[$action] = ( call_user_func( $test ) ) ? 'T' : 'F';

	/* Print the results the last time through. */
	if( 'shutdown' === $action ) {
		print &quot;\n&quot; . '&lt;h2&gt;Test: &lt;code&gt;' . $test . '()&lt;/code&gt;&lt;/h2&gt;';
		print &quot;\n&quot; . '&lt;table&gt;';
		foreach( $results as $a =&gt; $r ) {
			print &quot;\n&quot; . '&lt;tr&gt;';
			print &quot;\n&quot; . '&lt;td&gt;' . $r . '&lt;/td&gt;';
			print &quot;\n&quot; . '&lt;td&gt;' . $a . '&lt;/td&gt;';
			print &quot;\n&quot; . '&lt;/tr&gt;';
		}
		print &quot;\n&quot; . '&lt;/table&gt;';
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/2010/function-testing-with-action-hooks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Enable Long Description Attributes on Images</title>
		<link>http://wordpress.mfields.org/2010/how-to-enable-longdesc-attributes-on-images-in-wordpress/</link>
		<comments>http://wordpress.mfields.org/2010/how-to-enable-longdesc-attributes-on-images-in-wordpress/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 08:25:20 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://wordpress.mfields.org/?p=316</guid>
		<description><![CDATA[One of the presentations I watched at WordCamp Portland was WordPress &#038; Accessibility by Domanique Alicia. Something that was brought up during the question and answer session was support for the longdesc attribute on attachments. This attribute allows you to specify a text alternative for an image by referencing a url. You may already be]]></description>
			<content:encoded><![CDATA[<p>One of the presentations I watched at WordCamp Portland was <em>WordPress &#038; Accessibility</em> by <a href="http://www.domaniquealicia.com/">Domanique Alicia</a>. Something that was brought up during the question and answer session was support for the <abbr title="Long Description">longdesc</abbr> attribute on attachments. This attribute allows you to specify a text alternative for an image by referencing a <abbr title="Uniform Resource Locator">url</abbr>. You may already be using the <abbr title="alternative text">alt</abbr> attribute to provide alternative text, but what if you have an image of a pie chart or a line graph where the may be too much information to display in a single paragraph? That&#8217;s where <abbr title="Long Description">longdesc</abbr> can come in handy. It enables you to link the image to an html document that can fully explain the data that is hidden from screen readers. <span id="more-316"></span></p>
<p>It seemed that no one had ever seen a plugin that did this. Domanique asked if anyone knew how this could be accomplished and I raised my have and offered a solution. And now I&#8217;m offering it here as well. It was actually very simple to do and there are only two steps&#8230;</p>
<h2>Step #1 Create a html document for every attachment.</h2>
<p>To accomplish this we are going to use send a post&#8217;s id to wp-admin/admin-ajax.php and have it print out the data entered in the post_content column.</p>
<pre class="brush: php; title: ; notranslate">
/**
 * Generate a html document that displays only post_content.
 * @uses $_GET['id'] int post ID.
 * @return void.
 * @since 2010-09-20
 */
function longdesc() {
	$id = null;
	$content = '';
	if( isset( $_GET['id'] ) ) {
		$id = (int) abs( $_GET['id'] );
	}
	global $post;
	$post = get_post( $id );
	if( isset( $post-&gt;post_content ) ) {
		remove_filter( 'the_content', 'prepend_attachment' );
		setup_postdata( $post );
		?&gt;
&lt;!DOCTYPE html&gt;
&lt;html &lt;?php language_attributes(); ?&gt;&gt;
&lt;head&gt;
&lt;meta charset=&quot;&lt;?php bloginfo( 'charset' ); ?&gt;&quot; /&gt;
&lt;title&gt;&lt;?php the_title(); ?&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php the_content(); ?&gt;
&lt;/body&gt;
&lt;/html&gt;
	&lt;?php
	}
	else {
		header( 'HTTP/1.0 404 Not Found' );
	}
	exit;
}
add_action( 'wp_ajax_nopriv_longdesc', 'longdesc' );
add_action( 'wp_ajax_longdesc', 'longdesc' );
</pre>
<h2>Step #2 Add the <abbr title="Long Description">longdesc</abbr> attribute to the img tag.</h2>
<pre class="brush: php; title: ; notranslate">
/**
 * Add longdesc attribute when WordPress sends image to the editor.
 * @return string
 * @since 2010-09-20
 */
function longdesc_add_attr( $html, $id, $caption, $title, $align, $url, $size, $alt ) {
	$id = (int) $id;
	$url = esc_url( admin_url( 'admin-ajax.php' ) . '?action=longdesc&amp;amp;id=' . $id );
	$post = get_post( $id );
	if( isset( $post-&gt;post_content ) &amp;&amp; !empty( $post-&gt;post_content ) ) {
		$search = 'title=&quot;' . $title . '&quot;';
		$replace = $search . ' longdesc=&quot;' . $url . '&quot;';
		return str_replace( $search, $replace, $html );
	}
	return $html;
}
add_filter( 'image_send_to_editor', 'longdesc_add_attr', 10, 8 );
</pre>
<p>That&#8217;s all there is to it. Add this code to your theme&#8217;s functions.php file or a plugin and you&#8217;ll be one step closer to having an accessible website.</p>
<h2>What do you think?</h2>
<p>Would you approach this in a different manner? Are there any changes you would make to the code? If so, don&#8217;t hesitate to leave a comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/2010/how-to-enable-longdesc-attributes-on-images-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>ArtPress Update: Portfolio Navigation</title>
		<link>http://wordpress.mfields.org/2010/artpress-update-portfolio-navigation/</link>
		<comments>http://wordpress.mfields.org/2010/artpress-update-portfolio-navigation/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 07:10:55 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://wordpress.mfields.org/?p=276</guid>
		<description><![CDATA[If you&#8217;ve been following the ArtPress project at all you know that I&#8217;ve been saying &#8220;I&#8217;ll have a BETA out in about a week&#8221; for more than a couple of weeks now. I&#8217;m writing to inform you that I&#8217;m still plugging away and am in the home stretch. There&#8217;s just a few things that need]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been following the ArtPress project at all you know that I&#8217;ve been saying <em>&#8220;I&#8217;ll have a BETA out in about a week&#8221;</em> for more than a couple of weeks now. I&#8217;m writing to inform you that I&#8217;m still plugging away and am in the home stretch. There&#8217;s just a few things that need to be taken care of: <span id="more-276"></span></p>
<h3>Settings Panel</h3>
<p>This is currently a cramped up mess. It needs to be broken into individual pages for ease of use. Currently there are settings sections for <em>Classification Methods</em>, <em>Theme Integration</em>, <em>Modules</em>, <em>Pricing</em>, <em>Overview</em> and <em>Custom Post Type Labels</em>. My initial idea was to have them all on one page which totally works, but I found it to be a bit overwhelming and it didn&#8217;t really make sense when viewed on screens with small resolutions. Hopefully this shouldn&#8217;t take too long.</p>
<p>I also need to activate a bunch of settings for the display of pieces on both single and multiple views. My goal is for ArtPress to be able to work on as many themes as possible which involves putting a fair share of control into the artist&#8217;s hands. Colors, white-space, image sizes and &#8220;elements&#8221; <em>(things like edit links, comments on multiple views, pricing)</em> all need to be able to be adjusted via the <em>Theme Integration</em> interface. I&#8217;m probably about 90% of the way there on this. Luckily I found a few awesome GPL scripts that made this process easier.</p>
<p>Mad Props to <strong><a href="http://austinmatzko.com/">Austin Matzko</a></strong> who&#8217;s <a href="http://austinmatzko.com/2010/03/11/plugin-creates-wordpress-thumbnails-on-demand/">Custom Image Sizes</a> plugin served as a base for ArtPress&#8217;s automatic image resizing functionality.</p>
<p>And a big &#8216;ole High Five to <strong><a href="http://www.eyecon.ro/">Stefan Petre</a></strong> for creating the awesome <a href="http://www.eyecon.ro/colorpicker/">Color Picker</a> plugin for <a href="http://jquery.com/">jQuery</a>. ArtPress uses this script to provide easy color selection for borders and backgrounds.</p>
<h3>Widgets</h3>
<p>I had initially put widget creation on hold and then I ran into a problem today with theme integration. The built-in WordPress function for paging on single views do not allow me to hook into them in a way that would provide seamless navigation from an image page to the next or previous parent&#8217;s page. This will be very important for artists who choose to upload more than one image for any given piece. The only real solution that I found was to <a href="http://core.trac.wordpress.org/ticket/14440">post a patch</a>, hope for the best and create a widget that provides navigation. I&#8217;ve also found that some themes do not provide previous and next navigation by default. So this <em>needs</em> to be done before I can release the plugin. </p>
<p>I guess that&#8217;s all that really needs to be done. I&#8217;m getting pretty close. This is exciting!</p>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/2010/artpress-update-portfolio-navigation/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ArtPress Image Attachments</title>
		<link>http://wordpress.mfields.org/2010/artpress-image-attachments/</link>
		<comments>http://wordpress.mfields.org/2010/artpress-image-attachments/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 11:46:17 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://wordpress.mfields.org/?p=275</guid>
		<description><![CDATA[It&#8217;s been a while since I posted anything here. And yes! Yes I do have a good excuse. I&#8217;ve pretty much taken the past month and a half to cook up a new WordPress plugin. It&#8217;s called ArtPress and should be in BETA very soon. I&#8217;m working on the logistics of launching it + squashing]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since I posted anything here. And yes! Yes I do have a good excuse. I&#8217;ve pretty much taken the past month and a half to cook up a new WordPress plugin. It&#8217;s called ArtPress and should be in BETA very soon. I&#8217;m working on the logistics of launching it + squashing all the bugs. I posted a couple of questions <a href="http://www.wptavern.com/forum/plugins-hacks/1799-how-release-plugin.html">here</a> regarding a few areas in which I do not have all that much experience. <span id="more-275"></span></p>
<p>I&#8217;ve also created the first how-to screencast. Please watch it, and provide feedback in the comments section. I do have a few questions regarding it functionality. Please see below for specifics.</p>
<p><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0' width='560' height='345'><param name='movie' value='http://screenr.com/Content/assets/screenr_1116090935.swf' /><param name='flashvars' value='i=90506' /><param name='allowFullScreen' value='true' /><embed src='http://screenr.com/Content/assets/screenr_1116090935.swf' flashvars='i=90506' allowFullScreen='true' width='560' height='345' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object></p>
<h2>My Questions</h2>
<ol>
<li>What do you think?</li>
<li>When a user attaches the image to the piece, would it be better to add it to the end of the blue box, or at the beginning?</li>
<li>Is there anything that you would add/remove/alter?</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/2010/artpress-image-attachments/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>WordPress Plugin Support Aggregator</title>
		<link>http://wordpress.mfields.org/2010/wordpress-plugin-support-aggregator/</link>
		<comments>http://wordpress.mfields.org/2010/wordpress-plugin-support-aggregator/#comments</comments>
		<pubDate>Sat, 29 May 2010 03:57:08 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://wordpress.mfields.org/?p=251</guid>
		<description><![CDATA[I make plugins for WordPress and I make it a point to host as many of them as possible in the Official WordPress Plugin Directory. I also like to support my plugins and prefer to do so at the WordPress Support Forums. Unfortunately, there is no easy way to see if someone has posted a]]></description>
			<content:encoded><![CDATA[<p>I make plugins for WordPress and I make it a point to host as many of them as possible in the <a href="http://wordpress.org/extend/plugins/">Official WordPress Plugin Directory</a>. I also like to support my plugins and prefer to do so at the <a href="http://wordpress.org/support/">WordPress Support Forums</a>. Unfortunately, there is no easy way to see if someone has posted a new question except for clicking on all of the plugin pages and scrolling down to the &#8220;See what others are saying&#8230;&#8221; section on the right-hand sidebar. While I wish that these two sections of WordPress.org were better integrated this is currently not the case. For the time being, I came up with a solution that I would like to share with you. <span id="more-251"></span></p>
<p><img src="http://wordpress.mfields.org/wp-content/uploads/2010/05/wordpress-plugin-support-dashboard-widget.gif" alt="" title="wordpress-plugin-support-dashboard-widget" width="539" height="358" class="aligncenter size-full wp-image-254" /></p>
<h2>Mad Props to the Following&#8230;</h2>
<p>The following solution was created gluing together two tutorials that I have read. The first is an easy to follow article by Jeff Star on Perisable Press titled <a href="http://perishablepress.com/press/2009/04/26/import-and-display-rss-feeds-in-wordpress/">How to Import and Display RSS Feeds in WordPress</a>. Jeff walks us through using the SimplePie class. The second tutorial was written by Devin Price and focuses on controlling what is displayed on the WordPress Dashboard and is titled <a href="http://wptheming.com/2010/02/dashboard-support-widgets/">Dashboard Support Widgets</a>.</p>
<p>My goal was to combine these two tutorials into a custom solution where I would create a custom Dashboard Widget that displayed the 10 latest support questions for all of my plugins hosted on WordPress.org.</p>
<h2>Create a Cache Directory</h2>
<p>The first step is to create a cache directory on the server where WordPress is installed. In this example, I have created a directory named &#8220;wordpress-plugin-support-cache&#8221; directly under /wp-content/. You will want to set the new directory&#8217;s file permissions to 755.</p>
<h2>Getting the Feeds</h2>
<p>Fortunately, the Plugin Directory provides us with a public RSS feed for each plugin&#8217;s support section. The first step in finding the feed is to navigate to the plugins main page in the directory and click on the &#8220;Forum Posts&#8221; link.</p>
<p><img src="http://wordpress.mfields.org/wp-content/uploads/2010/05/plugin-page-click-on-forum-posts-rss.gif" alt="" title="plugin-page-click-on-forum-posts-rss" width="599" height="387" class="aligncenter size-full wp-image-256" /></p>
<p>You will want to click on the little orange RSS Feed icon to the right of &#8220;Forum Posts&#8221;. This will take you directly to the feed. Clicking on the text &#8220;Forum Posts&#8221; will bring you to a tag archive for support forums.</p>
<h2>Save Some Time!</h2>
<p>You do not need to follow the above process every single plugin that you have. Once you have one feed all you really need to do is modify the unique identifier in the url. Here&#8217;s the url for the support feed for my <a href="http://wordpress.mfields.org/plugins/taxonomy-images/">Taxonomy Images Plugin</a>:</p>
<pre>http://wordpress.org/support/rss/tags/taxonomy-images</pre>
<p>The unique identifier here is &#8220;taxonomy-images&#8221; which is basically the title of the plugin in lowercase with spaces replaced by dashes. Here are all the links to my plugins hosted on Wordress.org:</p>
<pre>http://wordpress.org/support/rss/tags/category-radio-buttons

http://wordpress.org/support/rss/tags/taxonomy-widget

http://wordpress.org/support/rss/tags/taxonomy-list-shortcode

http://wordpress.org/support/rss/tags/taxonomy-images

http://wordpress.org/support/rss/tags/taxonomy-terms-list

http://wordpress.org/support/rss/tags/bulk-image-resize-utility</pre>
<h2>Creating the Widget</h2>
<pre class="brush: php; title: ; notranslate">
if( !function_exists( 'mfields_dashboard_widget_plugin_support_aggregator' ) ) {
	function mfields_dashboard_widget_plugin_support_aggregator() {
		$feed_urls = array(
			'http://wordpress.org/support/rss/tags/category-radio-buttons',
			'http://wordpress.org/support/rss/tags/taxonomy-widget',
			'http://wordpress.org/support/rss/tags/taxonomy-list-shortcode',
			'http://wordpress.org/support/rss/tags/taxonomy-images',
			'http://wordpress.org/support/rss/tags/taxonomy-terms-list',
			'http://wordpress.org/support/rss/tags/bulk-image-resize-utility',
			);

		include_once ABSPATH . WPINC . '/class-simplepie.php';
		$feed = new SimplePie();
		$feed-&gt;set_feed_url( $feed_urls );
		$feed-&gt;set_cache_location( WP_CONTENT_DIR . '/wordpress-plugin-support-cache/' );
		$feed-&gt;set_cache_duration( 999 );
		$feed-&gt;handle_content_type();
		$check = $feed-&gt;init();

		if ( $check ) {
			print &quot;\n\t&quot; . '&lt;ul&gt;';
			foreach ( $feed-&gt;get_items( 0, 10 ) as $item ) {
				$blog = '';
				$href = $item-&gt;get_permalink();
				$title = $item-&gt;get_title();

				print &quot;\n\t&quot; . '&lt;li&gt;&lt;a href=&quot;' . $href . '&quot;&gt;' . $title . '&lt;/a&gt;&lt;/li&gt;';
			}
			print &quot;\n\t&quot; . '&lt;/ul&gt;';
		}
		else {
			print &quot;\n\t&quot; . '&lt;h2&gt;Feeds currently not available&lt;/h2&gt;';
			print &quot;\n\t&quot; . '&lt;p&gt;Please try again later&lt;/p&gt;';
		}
	}
}</pre>
<p>This function is based of the knowledge that I gained from the <a href="http://perishablepress.com/press/2009/04/26/import-and-display-rss-feeds-in-wordpress/">SimplePie article</a> on Perisable Press. You will want to replace my feed urls with you own in the $feed_urls array.</p>
<h2>Register the Dashboard Widget</h2>
<pre class="brush: php; title: ; notranslate">
if( !function_exists( 'mfields_dashboard_widget_plugin_support_aggregator_init' ) ) {
	add_action('wp_dashboard_setup', 'mfields_dashboard_widget_plugin_support_aggregator_init');
	function mfields_dashboard_widget_plugin_support_aggregator_init() {
		wp_add_dashboard_widget(
			'mfields_dashboard_widget_plugin_support_aggregator',
			'WordPress Plugin Support',
			'mfields_dashboard_widget_plugin_support_aggregator'
			);
	}
}
</pre>
<p>This function was derived from the code that I found in Devin&#8217;s article. If you would like to change the title on the widget please modify the second argument passed to the wp_add_dashboard_widget() function.</p>
<h2>That&#8217;s Really All There is to It!</h2>
<p>You can copy and paste the following two functions into you theme&#8217;s functions.php or use them in a custom plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/2010/wordpress-plugin-support-aggregator/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

