<?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; Administration Panels</title>
	<atom:link href="http://wordpress.mfields.org/topics/administration-panels/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>Custom List Table Example</title>
		<link>http://wordpress.mfields.org/bookmark/custom-list-table-example/</link>
		<comments>http://wordpress.mfields.org/bookmark/custom-list-table-example/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 00:27:13 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
		
		<guid isPermaLink="false">http://wordpress.mfields.org/?post_type=mfields_bookmark&#038;p=487</guid>
		<description><![CDATA[Custom List Table Example Plugin]]></description>
			<content:encoded><![CDATA[Custom List Table Example Plugin]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/bookmark/custom-list-table-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bookmark This!</title>
		<link>http://wordpress.mfields.org/2010/bookmark-this/</link>
		<comments>http://wordpress.mfields.org/2010/bookmark-this/#comments</comments>
		<pubDate>Tue, 14 Dec 2010 14:29:53 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://wordpress.mfields.org/?p=337</guid>
		<description><![CDATA[Earlier today I posted that I was thinking about creating a Chrome extension which would allow me to easily add new sites to my bookmarks section. My friend Devin responded asking if I knew about the Press This functionality. Although I was in fact aware of Press This, I had to admit that I&#8217;ve never]]></description>
			<content:encoded><![CDATA[<p>Earlier today <a href="http://twitter.com/#!/_mfields/status/14496398959452160">I posted</a> that I was thinking about creating a Chrome extension which would allow me to easily add new sites to my <a href="http://wordpress.mfields.org/bookmarks/">bookmarks section</a>. My friend <a href="http://wptheming.com/">Devin</a> responded asking if I knew about the <a href="http://codex.wordpress.org/Press_This">Press This</a> functionality. Although I was in fact <em>aware</em> of Press This, I had to admit that I&#8217;ve never actually used it before so I gave it a try. While I was quite impressed with what it did, it did not really do what I needed. <span id="more-337"></span></p>
<h2>How <em>Press This</em> Works</h2>
<p>If you log into WordPress and navigate to <em>Settings</em> -> <em>Writing</em> you will find a heading for &#8220;Press This&#8221; which instructs you to drag a link into the bookmarks bar in your browser. What you are bookmarking is not really a link but a small javascript application known as a <a href="http://en.wikipedia.org/wiki/Bookmarklet">bookmarklet</a>. You can now navigate to any webpage and when you click your <em>Press This</em> bookmarklet a popup window will open which displays a form allowing you to publish a post about the page. What impressed me here is that certain fields are already filled out:</p>
<ol>
<li>The title tag of the html document is inserted as the value of the post title.</li>
<li>If any text was selected, it is inserted into the content box</li>
<li>A link to the document is appended to the content box.</li>
</ol>
<h2>What I Need to Do</h2>
<ol>
<li>I need to create a bookmark and not a post.</li>
<li>I need to automatically set the title.</li>
<li>I need all custom taxonomies to display.</li>
<li>I need to set the name and value of a custom field.</li>
</ol>
<p>On my site I have one custom post_type registered (mfields_bookmark) which I use to archive interesting articles about web development that I have read. Unfortunately, Press This only seems to enable you to create &#8220;posts&#8221;. My initial idea was to create a custom popup window by copying the code from <code>press-this.php</code> into a custom function which would be triggered via <code>admin-ajax.php</code>. Seemed like a good idea, but it also sounded like a lot of work! After thinking about it, I really didn&#8217;t need the popup window, I would be happy if my bookmarklet just opened <code>post-new.php</code> in a new tab. So I started hacking <code>post-new.php's</code> query string to see if the post form would recognize any values&#8230; And it did!</p>
<h3>Post Title</h3>
<p>The post title can be injected by setting a value to <var>post_title</var>. Something Like this works rather well: <code>/wp-admin/post-new.php?post_title=TITLE</code></p>
<p>Although, I will not need to set the content here, I found that it can easily be set in much the same way: <code>/wp-admin/post-new.php?content=CONTENT</code></p>
<h3>Custom Field</h3>
<p>I only need one custom field to be defined for a <i>bookmark</i> post to function properly. I couldn&#8217;t find any hooks that I could use in core  so I decided to try a bit of javascript. I came up with the following code which I added to my theme&#8217;s functions.php file:</p>
<pre class="brush: php; title: ; notranslate">add_action( 'admin_head-post-new.php', 'mfields_process_bookmark_bookmarklet' );

function mfields_process_bookmark_bookmarklet() {
	global $post;
	if ( isset( $post-&gt;post_type ) &amp;&amp; 'mfields_bookmark' === $post-&gt;post_type &amp;&amp; isset( $_GET['mfields_bookmark_url'] ) ) {
		$url = esc_url( $_GET['mfields_bookmark_url'] );
		print &lt;&lt;&lt; EOF
		&lt;script type=&quot;text/javascript&quot;&gt;
		jQuery( document ).ready( function ( $ ) {
			$( '#metakeyselect' ).val( 'resource_url' );
			$( '#metavalue' ).text( '{$url}' );
		} );
		&lt;/script&gt;
EOF;
	}
}</pre>
<p>This function will fire during the <code>admin_head</code> action on <code>post-new.php</code> for the mfields_bookmark post_type. If <var>mfields_bookmark_url</var> is defined in the query string, the function will automatically select it as the name from the select box. Likewise, the value of <var>mfields_bookmark_url</var> will be used as the value of the custom field.</p>
<h2>Creating the Bookmarklet</h2>
<p>Now that WordPress has been configured to recognize this custom information, I needed to create an easy way of sending it. I copied the <i>Press This</i> javascript and reworked it to talk to <code>post-new.php</code>.</p>
<pre class="brush: jscript; title: ; notranslate">javascript:(
	function(){
		var title = encodeURIComponent( document.title ),
		bookmark = encodeURIComponent( document.location.href ),
		url = 'http://example.com/wp-admin/post-new.php?post_type=mfields_bookmark&amp;mfields_bookmark_url=' + bookmark + '&amp;post_title=' + title;
		window.open(url);
	}
)();</pre>
<p>Basically when you call this function, it will open post-new.php in a new tab sending the title and url of the document you were just viewing as well as setting the value of post_type to mfields_bookmark.</p>
<p>Adding this code to your browser is simple. In Chrome you can right-click the bookmarks toolbar and select <i>Add Page&#8230;</i>. Type &#8220;Bookmark This&#8221; as the name and use the javascript as the url. It might be a good idea to have the script on one line like this:</p>
<pre class="brush: jscript; title: ; notranslate">javascript:(function(){ var title = encodeURIComponent( document.title ), bookmark = encodeURIComponent( document.location.href ), url = 'http://example.com/wp-admin/post-new.php?post_type=mfields_bookmark&amp;mfields_bookmark_url=' + bookmark + '&amp;post_title=' + title; window.open(url); })();</pre>
<p>I hope that someone out there finds this useful. I&#8217;m pretty excited about it as it will really cut down the steps involved in posting bookmarks on my site.</p>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/2010/bookmark-this/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dynamically Create Actions for Every Defined Taxonomy&#8217;s Column Header</title>
		<link>http://wordpress.mfields.org/2010/dynamically-create-actions-for-every-defined-taxonomys-column-header/</link>
		<comments>http://wordpress.mfields.org/2010/dynamically-create-actions-for-every-defined-taxonomys-column-header/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 02:59:50 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://wordpress.mfields.org/?p=262</guid>
		<description><![CDATA[Taxonomy support in WordPress 3.0 has improved in many places. During the time I spent updating a few of my plugins, I noticed that dynamic filters had been defined for the columns that appear on edit-tags.php &#8211; the file that lists the terms for each taxonomy in the administration panels. The following snippet demonstrates how]]></description>
			<content:encoded><![CDATA[<p>Taxonomy support in WordPress 3.0 has improved in many places. During the time I spent updating a few of my <a href="http://wordpress.mfields.org/plugins/">plugins</a>, I noticed that dynamic filters had been defined for the columns that appear on edit-tags.php &#8211; the file that lists the terms for each taxonomy in the administration panels. The following snippet demonstrates how to schedule a function to be fired for every taxonomy&#8217;s custom column. <span id="more-262"></span></p>
<pre class="brush: php; title: ; notranslate">
if( !function_exists( 'mfields_taxonomy_add_term_row_actions' ) ) {
	add_action( 'admin_init', 'mfields_taxonomy_add_term_row_actions' );
	/**
	 * Dynamically create actions for every defined taxonomy.
	 */
	function mfields_taxonomy_add_term_row_actions() {
		global $wp_taxonomies;
		foreach( $wp_taxonomies as $taxonomy =&gt; $taxonomies ) {
			$action = 'manage_' . $taxonomy . '_custom_column';
			add_action( $action, 'your_function_name', 10, 3 );
		}
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/2010/dynamically-create-actions-for-every-defined-taxonomys-column-header/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dealing with Long Taxonomy Descriptions in the WordPress Administration Panels</title>
		<link>http://wordpress.mfields.org/2010/dealing-with-long-taxonomy-descriptions-in-the-wordpress-administration-panels/</link>
		<comments>http://wordpress.mfields.org/2010/dealing-with-long-taxonomy-descriptions-in-the-wordpress-administration-panels/#comments</comments>
		<pubDate>Mon, 31 May 2010 04:48:04 +0000</pubDate>
		<dc:creator>Michael Fields</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://wordpress.mfields.org/?p=259</guid>
		<description><![CDATA[If you&#8217;re like me, you try to take full advantage of the taxonomy system the the latest version of WordPress. Unfortunately, the taxonomy administration panels tend to get quickly bloated where terms have descriptions that are longer than a few words. Here is a quick and easy method to help put an end to long]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re like me, you try to take full advantage of the taxonomy system the the latest version of WordPress. Unfortunately, the taxonomy administration panels tend to get quickly bloated where terms have descriptions that are longer than a few words. Here is a quick and easy method to help put an end to long descriptions messing with your work flow. <span id="more-259"></span></p>
<h2>Shorten the Term Descriptions</h2>
<pre class="brush: php; title: ; notranslate">
/**
 * Create actions for all taxonomies.
 *
 * @return    void
 *
 * @since     2010-05-31
 * @alter     2011-01-09
 */
function mfields_taxonomy_description_add_actions() {
	global $wp_taxonomies;
	foreach ( $wp_taxonomies as $taxonomy =&gt; $taxonomies ) {
		add_action( 'manage_' . $taxonomy . '_custom_column', 'mfields_taxonomy_description_rows', 10, 3 );
		add_action( 'manage_edit-' . $taxonomy . '_columns',  'mfields_taxonomy_description_columns' );
	}
}
add_action( 'admin_init', 'mfields_taxonomy_description_add_actions' );

/**
 * Filter the taxonomy tables columns.
 *
 * Remove the default &quot;Description&quot; column.
 * Add a custom &quot;Short Description&quot; column.
 *
 * @param     array     Unfiltered columns for the taxonomy's edit screen.
 * @return    array     Modified columns for the taxonomy's edit screen.
 *
 * @since     2010-05-31
 * @alter     2011-01-09
 */
function mfields_taxonomy_description_columns( $c ) {
	unset( $c['description'] );
	$c['short_description'] = 'Description';
	return $c;
}

/**
 * Display the shortened description in each row's custom column.
 *
 * @param     string    Should be empty.
 * @return    string    Name of the column.
 * @return    string    Term id. Integer represented as string.
 *
 * @since     2010-05-31
 * @alter     2011-01-09
 */
function mfields_taxonomy_description_rows( $string, $column_name, $term ) {
	$description = '';
	if ( 'short_description' == $column_name ) {
		global $taxonomy;
		$description = term_description( $term, $taxonomy );
	}
	return $string . mfields_shorten( $description, 40 );
}

/**
 * Shorten a string to a given length.
 *
 * @param     string    The string to shorten.
 * @return    int       Number of characters allowed in $string. Defaults value is 23.
 * @return    string    Text to append to the shortened string.
 *
 * @since     2010-05-31
 * @alter     2011-01-09
 */
function mfields_shorten( $string, $length = 23, $append = '...' ) {
	$string = strip_tags( $string );
	$string = trim( $string );
	$string = html_entity_decode( $string, ENT_QUOTES, 'UTF-8' );
	$string = rtrim( $string, '-' );
	return ( strlen( $string ) &gt; absint( $length ) ) ? substr_replace( $string, $append, absint( $length ) ) : $string;
}
</pre>
<p>Hope someone finds this useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.mfields.org/2010/dealing-with-long-taxonomy-descriptions-in-the-wordpress-administration-panels/feed/</wfw:commentRss>
		<slash:comments>7</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>

