<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>scompt.com &#187; wordpress</title>
	<atom:link href="http://scompt.com/blog/archives/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://scompt.com</link>
	<description>The website of Edward Dale</description>
	<lastBuildDate>Sat, 23 Jan 2010 15:32:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>WordPress GSoC 2009 Idea: Workflow</title>
		<link>http://scompt.com/blog/archives/2009/03/29/wordpress-gsoc-2009-idea-workflow</link>
		<comments>http://scompt.com/blog/archives/2009/03/29/wordpress-gsoc-2009-idea-workflow#comments</comments>
		<pubDate>Mon, 30 Mar 2009 02:38:18 +0000</pubDate>
		<dc:creator>Edward Dale</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://scompt.com/?p=273</guid>
		<description><![CDATA[Birds are chirping, trees are blooming, and each day is a little longer.  This can mean only one thing: Google Summer of Code is upon us.  This year, I&#8217;m proposing to add a publishing workflow to WordPress.

Introduction
Some of these ideas are taken from a page I started on the WordPress Codex to mull [...]]]></description>
			<content:encoded><![CDATA[<p>Birds are chirping, trees are blooming, and each day is a little longer.  This can mean only one thing: <a href="http://code.google.com/soc/">Google Summer of Code</a> is upon us.  This year, I&#8217;m proposing to add a publishing workflow to <a href="http://wordpress.org/">WordPress</a>.</p>
<p><span id="more-273"></span></p>
<h2>Introduction</h2>
<p>Some of these ideas are taken from a <a href="http://codex.wordpress.org/User:Scompt/Workflow_With_WordPress">page</a> I started on the WordPress Codex to mull over workflow ideas.</p>
<p>WordPress is built to cater to the single user running a personal blog up to the global company running an entire website. In the big cases such as the latter, some controls and processes need to be in place to restrict what users can do and to assure that certain events take place in the correct order. Collectively, I&#8217;ll call these controls and processes a workflow and they&#8217;re the heart of the project I&#8217;d like to do for Google Summer of Code.</p>
<p>Wikipedia defines a workflow as:</p>
<blockquote><p>A workflow is a reliably repeatable pattern of activity enabled by a systematic organization of resources, defined roles and mass, energy and information flows, into a work process that can be documented and learned. </p></blockquote>
<p>This definition can be trimmed and refined a bit to better suit its application to WordPress, yielding:</p>
<blockquote><p>A workflow is a reliably repeatable pattern of activity enabled by a systematic organization of resources, defined roles, and information flows, into a work process that can be documented and learned. </p></blockquote>
<h2>Use Cases</h2>
<ul>
<li><strong>category editors</strong> &#8211; to be published in a category, a post/page must be approved by an editor for that category</li>
<li> <strong>writer->editor->designer</strong> &#8211; the writer writes text, which is edited by the editor, and then made pretty by the designer</li>
<li><strong>the big boss</strong> &#8211; everything that gets published must get the ok of the boss</li>
</ul>
<h2>System Design</h2>
<p>I envision the workflow system being implemented as a plugin.  I don&#8217;t think the number of people needing workflow controls justify putting it in the core.  I do, however, think there is a critical mass of sites that would benefit from the plugin.</p>
<p>My initial thinking about the plugin leads to three main components: design, notification, and moderation.</p>
<h3>Design</h3>
<p>Under &#8216;design&#8217;, I categorize the definition of the workflow.  This would be a &#8216;Settings&#8217; page and would utilize some kind of GUI to create a funnel-like representation of the workflow.  Posts/pages enter the system at the wide end of the funnel, go through a number of workflow stages, and emerge <em>published</em> at the other end.    Designing the workflow would consist of creating vertices and edges in this tree.  Vertices are moderation checkpoints that must be passed in order to move towards the root (publication).  Edges are the path that documents travel along.</p>
<p>Another facet of the workflow design is assigning users to the vertices.  A user at a vertex is the gatekeeper (moderator) of that stage, allowing documents to pass unscathed, modifying them, and/or sending them back to the previous stage.  Here, I picture a drag/drop interface to assign users to vertices.  Multiple users can occupy a vertex, as can one user occupy multiple vertices.</p>
<h3>Notification</h3>
<p>Notification is simply the idea that a user be notified when a document reaches his/her stage.  This would naturally occur when a document has passed from the previous stage, but also when a document has been turned back from the next stage.  Some options would be useful here to prevent a user from getting swamped with notification emails.  For example, only notify a user once between logins or at most once per day.</p>
<h3>Moderation</h3>
<p>This is really the heart of the plugin.  In order to pass through a stage, a moderator for that stage has to approve a document.  The moderator can optionally modify the document before approving it.  Once approved, a document either moves to the next stage or is published.  A rejected document is sent back to the previous stage.  Comments can be attached to the document to provide a justification for the decision.</p>
<h2>Implementation</h2>
<p>The design component will be implemented as a settings page that allows the user to graphically design the workflow.  When saved, the workflow will be captured as a tree structure and written to the options table.</p>
<p>Each stage of the workflow will have a shortname (think post slug).  This short name will be used to call an action when a post {enters, exits, &#8230;} that stage.  For example, the action &#8216;workflow_editor_entered&#8217; would be called with the post/page id when an author submits a document to the editor stage.  Default action handlers would be included that would email the users in that stage.  This is the notification component.  These default action handlers could be disabled if a user wanted to just notice the waiting posts, or a different action handler that twittered or SMSed a user.</p>
<p>Forcing posts to go through the workflow would be largely accomplished with the current capabilities system.  Many of the capabilities are meta-capabilities and are also sent through a <em>user_has_cap</em> filter before being processed.  The plugin would add a handler to this filter that looked up in the workflow to see if that action was allowed.  For example, in the case of an author X working on post 100 in the editing stage, the filter would receive the values (X, 100, editing).  The plugin would determine if the user is able to pass posts through that stage.</p>
<p>There are a couple open questions about the implementation.  If a published document is edited, where does it enter the workflow pipeline?  Is the published version un-published?  How does the revision control introduced in WP 2.6 play factor in?</p>
<h2>Existing Functionality</h2>
<p>WordPress introduced the concept of a &#8216;pending review&#8217; state in version 2.3.  This was a big step towards providing a workflow system, but it doesn&#8217;t go far enough.  Indeed, it only covers the last use case above.  In that case, the &#8216;big boss&#8217; would need to be the only user with permission to publish.  All other users would be able to create posts/pages and submit them for review.  This only provides the <strong>moderation</strong> component of the design.  There&#8217;s no built-in mechanism to <strong>notify</strong> the boss that a post is waiting for review.  The only way to <strong>design</strong> the workflow is to designate the boss as having the publishing capability.  There&#8217;s no further way to design such a trivial workflow.</p>
<p>The pending state doesn&#8217;t provide a workflow, but it makes it much easier to implement a full workflow system.  Basically, the entire workflow exists inside of the pending state.  When the original author thinks that a document is ready to be published, it is submitted for review, at which point it enters the workflow system and is given the pending state.  The editors at that first level of the workflow are notified that a document is waiting for them.  An editor makes any necessary changes and passes the document through to the next stage in the workflow.  It is still in the pending state at this point.  Until the document reaches the root of the workflow and is green-lighted to be published, it&#8217;s in the pending state.</p>
<p>When Mark Jaquith posted about the <a href="http://markjaquith.wordpress.com/2007/06/16/new-wordpress-feature-pending-review/">new pending state</a> in June 2006, he wrote that &#8220;There are obviously a lot more &#8216;editorial process&#8217; types of features that we could implement&#8221;.  In addition, the comments on that post requested many of the features that this GSoC project would provide.</p>
<h2>Previous Work</h2>
<p>I&#8217;ve previously implemented a much simpler 1-stage workflow in a plugin called <a href="http://wordpress.org/extend/plugins/zensor">Zensor</a>.  It hasn&#8217;t been updated in quite a while due to external time constraints.  This work was done for a high school in Germany where all changes to the website needed to be approved by the headmaster.</p>
<h2>Public Comment</h2>
<p>I <a href="http://comox.textdrive.com/pipermail/wp-hackers/2009-March/025470.html">solicited comments</a> for this idea on the wp-hackers mailing list, but didn&#8217;t receive too much feedback.  Maybe more comments will appear below.</p>
<h2>Updates</h2>
<p><strong>4/10/2009</strong>: I added the Existing Functionality section and expanded on the Implementation details in response to comments from Jane Wells on the <a href="http://socghop.appspot.com/student_proposal/show/google/gsoc2009/scompt/t123838296093">GSoC site</a>.</p>
<blockquote><p>
I don&#8217;t think this has enough information. There is a review process built into WP core already&#8230; what actual functions are you proposing to built, how will they differ from current functions, and how will you approach it technically? Those are the questions that the application needs to answer.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://scompt.com/blog/archives/2009/03/29/wordpress-gsoc-2009-idea-workflow/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The most popular WordPress actions and filters</title>
		<link>http://scompt.com/blog/archives/2009/01/18/the-most-popular-wordpress-actions-and-filters</link>
		<comments>http://scompt.com/blog/archives/2009/01/18/the-most-popular-wordpress-actions-and-filters#comments</comments>
		<pubDate>Sun, 18 Jan 2009 21:32:59 +0000</pubDate>
		<dc:creator>Edward Dale</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[graphs]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://scompt.com/?p=250</guid>
		<description><![CDATA[WordPress has an amazing plugin system that has allowed thousands of plugins to be created.  At the heart of the plugin system are actions and filters that allow developers to hook into the WordPress internals and tweak things.  There are hundreds of actions and filters, many of which are described on the codex, [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress has an amazing plugin system that has allowed <a href="http://wordpress.org/extend/plugins/">thousands of plugins</a> to be created.  At the heart of the plugin system are actions and filters that allow developers to hook into the WordPress internals and tweak things.  There are hundreds of <a href="http://codex.wordpress.org/Plugin_API/Action_Reference">actions</a> and <a href="http://codex.wordpress.org/Plugin_API/Filter_Reference">filters</a>, many of which are described on the codex, and developers can create their own as well.  I was curious which ones were most used by plugin developers so I parsed the WordPress <a href="http://svn.wp-plugins.org">plugin database</a> and ended up with the graphs and analysis below.</p>
<p><span id="more-250"></span></p>
<h2>Top 20 WordPress actions</h2>
<a href="http://scompt.com/wordpress/wp-content/uploads/2009/01/top_actions.png"><img src="http://scompt.com/wordpress/wp-content/uploads/2009/01/top_actions-300x200.png" alt="" title="Most popular WordPress actions" width="300" height="200" class="aligncenter size-medium wp-image-251" /></a>
<p style="clear:both">
As is clear from the graph, the most popular WordPress action is <code>admin_menu</code>.  This makes sense, as one of the first things a plugin developer might want to do is have their plugin show up in the WordPress backend.  Not surprisingly, many of the other top 20 actions are used just to get the plugin up and running: <code>init</code>, <code>plugins_loaded</code>, <code>activate_</code>, <code>deactivate_</code>, etc.  The other well-represented group of actions are those dealing with the post life-cycle: <code>save_post</code>,<code>publish_post</code>,  <code>edit_post</code>, <code>delete_post</code>.</p>
<p>In total, there were 659 unique actions used 12373 times.  The graph above represents about 72% of the actions.</p>
<h2>Top 20 WordPress filters</h2>
<p><a href="http://scompt.com/wordpress/wp-content/uploads/2009/01/top_filters.png"><img src="http://scompt.com/wordpress/wp-content/uploads/2009/01/top_filters-300x200.png" alt="" title="Most popular WordPress filters" width="300" height="200" class="alignnone size-medium wp-image-252" /></a></p>
<p style="clear:both">
The shape of the top 20 filters graph is a bit different.  <code>the_content</code> is the clear favorite of plugin developers, along with a couple other content filters: <code>the_excerpt</code>, <code>the_content_rss</code>, <code>the_excerpt_rss</code>.  The query filters are also well-represented: <code>posts_where</code>, <code>query_vars</code>, <code>wp</code>, <code>posts_join</code>.  The filter graph drops off pretty quickly so that most of the filters are used a maximum of 20 times.</p>
<p>In total, there were 512 unique filters used 5071 times.  The above graph represents about 55% of the filters.</p>
<h2>Method</h2>
<p>I&#8217;ll post more about my method in the future.  The numbers and graphs should be current as of SVN revision #85627 on 1/10/2009.  A number of errors were encountered along the way and some corners were cut, so the numbers aren&#8217;t perfect.</p>
]]></content:encoded>
			<wfw:commentRss>http://scompt.com/blog/archives/2009/01/18/the-most-popular-wordpress-actions-and-filters/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Use WP-Crontrol to keep track of Akismet</title>
		<link>http://scompt.com/blog/archives/2008/06/18/use-wp-crontrol-to-keep-track-of-akismet</link>
		<comments>http://scompt.com/blog/archives/2008/06/18/use-wp-crontrol-to-keep-track-of-akismet#comments</comments>
		<pubDate>Wed, 18 Jun 2008 10:20:41 +0000</pubDate>
		<dc:creator>scompt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://scompt.com/?p=228</guid>
		<description><![CDATA[If you&#8217;re using Akismet to tackle spam on WordPress, there are a number of statistics available to you about your current spam situation.  These are all available in the Comments page of your blog, but who wants to go there every day to check up on things.  By taking control of WordPress Cron [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re using <a href="http://akismet.com/">Akismet</a> to tackle spam on WordPress, there are a number of statistics available to you about your current spam situation.  These are all available in the Comments page of your blog, but who wants to go there every day to check up on things.  By taking control of <a href="http://scompt.com/projects/wp-crontrol">WordPress Cron</a> with WP-Crontrol and a couple lines of code, you can receive this information sent by mail every day.</p>
<p><span id="more-228"></span></p>
<p>As discussed <a href="http://scompt.com/archives/2008/06/16/using-wordpress-cron-and-wp-crontrol-to-make-you-post-more">previously</a> in this <a href="http://scompt.com/archives/series/taking-control-of-wp-cron-using-wp-crontrol">series</a>, you&#8217;ll need to have <a href="http://scompt.com/projects/wp-crontrol">WP-Crontrol</a> installed and go to the Add PHP Cron Entry screen under Manage->Crontrol.  For Hook Code, enter the following snippet:</p>
<p><code>
<pre name="code" class="php">    $email  = 'There are currently ';
    $email .= akismet_spam_count();
    $email .= ' spams identified by Akismet, of which ';
    $email .= akismet_spam_count('comment');
    $email .= ' are comment spams and ';
    $email .= akismet_spam_count('trackback');
    $email .= ' are trackback spams.  Akismet has caught ';
    $email .= number_format_i18n(get_option('akismet_spam_count'));
    $email .= ' spams since you first installed it.';
    wp_mail('scompt@scompt.com', 'Spam statistics', $email);</pre>
<p></code></p>
<p>Notice that all we&#8217;re doing is tossing a string together and sending it off to the <code>wp_mail</code> function to be emailed.  You&#8217;ll of course want to change the email address.  I personally don&#8217;t need to know how much spam you&#8217;re getting&#8230; I&#8217;ve got problems of my own.</p>
]]></content:encoded>
			<wfw:commentRss>http://scompt.com/blog/archives/2008/06/18/use-wp-crontrol-to-keep-track-of-akismet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<series:name><![CDATA[Taking control of WP-Cron using WP-Crontrol]]></series:name>
	</item>
		<item>
		<title>Plugin Stats 1.1 Released</title>
		<link>http://scompt.com/blog/archives/2008/06/17/plugin-stats-11-released</link>
		<comments>http://scompt.com/blog/archives/2008/06/17/plugin-stats-11-released#comments</comments>
		<pubDate>Tue, 17 Jun 2008 10:41:56 +0000</pubDate>
		<dc:creator>scompt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[releases]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://scompt.com/?p=227</guid>
		<description><![CDATA[Last week, I released Version 1.0 (and quickly thereafter, Version 1.1) of a WordPress plugin called Plugin Stats!  The plugin is designed for WordPress plugin developers to keep track of downloads of their plugins.  The plugin graphs the number of downloads in three different ways:


A Shortcode for use in posts and pages
A template [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, I released Version 1.0 (and quickly thereafter, Version 1.1) of a WordPress plugin called <a href="http://scompt.com/projects/plugin-stats">Plugin Stats</a>!  The plugin is designed for WordPress plugin developers to keep track of downloads of their plugins.  The plugin graphs the number of downloads in three different ways:</p>
<p><span id="more-227"></span></p>
<ul>
<li>A <a href="http://codex.wordpress.org/Shortcode_API">Shortcode</a> for use in posts and pages</li>
<li>A template function for use in templates</li>
<li>A dashboard widget</li>
</ul>
<p>An example download graph looks like this:</p>
<a href='http://wordpress.org/extend/plugins/wp-crontrol/stats/'><img src='http://chart.apis.google.com/chart?chxr=1,1,15&chxp=0,0,15.56,32.78,49.44,66.67,83.33&chxt=x,y&chxl=0:|February|March|April|May|June|July&chs=360x100&cht=lc&chd=s:NRWfaERWWsEJNWWaWNWWfW00NNNWjRWfENNWnnNnRENnNjwsEfJjsjRNWsNaRaNajfwWanNnafNNajRNAfENAaajjaEWnffNAjaRfjfjE0WsWRRERRwaWJJaNRJRWJRWjJAEAANRNWJwaER9REJjRNJNJEJNWRJJEwRnJfaNNRnWaJJfaNNA&chtt=wp-crontrol&chm=h,FF0000,0,0,0.5|r,99FF99,0,0.14,0.56' /></a>
<p><a href="http://downloads.wordpress.org/plugin/plugin-stats.1.1.zip">Download Plugin-Stats Version 1.1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://scompt.com/blog/archives/2008/06/17/plugin-stats-11-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using WordPress Cron and WP-Crontrol to make you post more</title>
		<link>http://scompt.com/blog/archives/2008/06/16/using-wordpress-cron-and-wp-crontrol-to-make-you-post-more</link>
		<comments>http://scompt.com/blog/archives/2008/06/16/using-wordpress-cron-and-wp-crontrol-to-make-you-post-more#comments</comments>
		<pubDate>Mon, 16 Jun 2008 10:32:18 +0000</pubDate>
		<dc:creator>scompt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://scompt.com/?p=225</guid>
		<description><![CDATA[The new version of WP-Crontrol allows you to add new cron entries with code.  This allows you to write code that will repeatedly be executed without actually touching any .PHP files.  Below, I present a way to utilize this functionality to remind you to post something if you haven&#8217;t done so in the [...]]]></description>
			<content:encoded><![CDATA[<p>The new version of <a href="http://scompt.com/projects/wp-crontrol">WP-Crontrol</a> allows you to add new cron entries with code.  This allows you to write code that will repeatedly be executed without actually touching any .PHP files.  Below, I present a way to utilize this functionality to remind you to post something if you haven&#8217;t done so in the past two days.</p>
<p><span id="more-225"></span></p>
<div class="imageright">
<a title="PHP Cron Entry Screen" href="http://scompt.com/wordpress/wp-content/uploads/2008/06/php_cron_entry_screen.jpg"><img alt="PHP Cron Entry Screen" src="http://scompt.com/wordpress/wp-content/uploads/2008/06/php_cron_entry_screen-150x150.jpg"/></a></p>
<p>PHP Cron Entry Screen</p>
</div>
<p>The first requirement is to install <a href="http://scompt.com/projects/wp-crontrol">WP-Crontrol</a>.  This will add the Manage->Crontrol admin screen.  Head there and you&#8217;ll get a quick insight into what&#8217;s going on behind the scenes in the WP-Cron system.  We want to add a new PHP cron entry, so click on the small link next to &#8216;Add Cron Entry&#8217;.  Now you should have something like the screen to the right.</p>
<p>The code that we&#8217;re going to use for the hook is below.  I won&#8217;t go deep into it.  Suffice to say, it looks at the date of the most recent post.  If it&#8217;s more than 2 days old, it sends out an email reminder.</p>
<p><code>
<pre name="code" class="php">    global $post;
    $recent = new WP_Query("showposts=1");
    if( $recent->have_posts() ) {
        $recent->the_post();
        if(time()-strtotime($post->post_date)>60*60*24*2)
            mail('scompt@scompt.com', 'Post reminder',
                 "Hey!  You haven't posted in a while.");
    }</pre>
<p></code></p>
<p>The only other options to set are when to run the hook and how often.  After saving the hook, it should run immediately.  Depending on how good you&#8217;ve been, you&#8217;ll get an email.</p>
]]></content:encoded>
			<wfw:commentRss>http://scompt.com/blog/archives/2008/06/16/using-wordpress-cron-and-wp-crontrol-to-make-you-post-more/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<series:name><![CDATA[Taking control of WP-Cron using WP-Crontrol]]></series:name>
	</item>
		<item>
		<title>Twitterdoodle 1.0 Released</title>
		<link>http://scompt.com/blog/archives/2008/06/10/twitterdoodle-10-released</link>
		<comments>http://scompt.com/blog/archives/2008/06/10/twitterdoodle-10-released#comments</comments>
		<pubDate>Tue, 10 Jun 2008 09:15:42 +0000</pubDate>
		<dc:creator>scompt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[releases]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://scompt.com/?p=214</guid>
		<description><![CDATA[Over the weekend, I quietly released Twitterdoodle, a WordPress plugin which allows a user to create posts and categories based on Twitter keyword searches.  It uses Summize to provide search results.

The plugin was sponsored by The Lessnau Lounge which means each Twitterdoodle post contains a sponsored link to his site.  He&#8217;s advertised it [...]]]></description>
			<content:encoded><![CDATA[<p>Over the weekend, I quietly released <a href="http://wordpress.org/extend/plugins/twitterdoodle/">Twitterdoodle</a>, a WordPress plugin which allows a user to create posts and categories based on <a href="http://twitter.com">Twitter</a> keyword searches.  It uses <a href="http://summize.com">Summize</a> to provide search results.</p>
<p><span id="more-214"></span></p>
<p>The plugin was sponsored by <a href="http://www.lessnau.com/">The Lessnau Lounge</a> which means each Twitterdoodle post contains a sponsored link to his site.  He&#8217;s advertised it a bit better and word of it is already popping up on <a href="http://www.google.com/search?q=twitterdoodle">Google</a>, etc.</p>
<p><a href="http://downloads.wordpress.org/plugin/twitterdoodle.1.0.zip">Download Twitterdoodle 1.0</a></p>
]]></content:encoded>
			<wfw:commentRss>http://scompt.com/blog/archives/2008/06/10/twitterdoodle-10-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP-Crontrol 1.0 Released</title>
		<link>http://scompt.com/blog/archives/2008/06/06/wp-crontrol-10-released</link>
		<comments>http://scompt.com/blog/archives/2008/06/06/wp-crontrol-10-released#comments</comments>
		<pubDate>Fri, 06 Jun 2008 09:32:24 +0000</pubDate>
		<dc:creator>scompt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[releases]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://scompt.com/?p=213</guid>
		<description><![CDATA[WP-Crontrol has hit 1.0!  The powerful new features in this version allow you to take complete control over what&#8217;s happening in the WP-Cron system.  Here&#8217;s what&#8217;s new:


Input PHP code directly into the Crontrol interface.
Non-repeating (one-offs) cron entries can be scheduled.
Cron entries with arguments are now properly handled

For plugin developers writing plugins using the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://scompt.com/projects/wp-crontrol">WP-Crontrol</a> has hit 1.0!  The powerful new features in this version allow you to take complete control over what&#8217;s happening in the <a href="http://codex.wordpress.org/Category:WP-Cron_Functions">WP-Cron</a> system.  Here&#8217;s what&#8217;s new:</p>
<p><span id="more-213"></span></p>
<ul>
<li>Input PHP code directly into the Crontrol interface.</li>
<li>Non-repeating (one-offs) cron entries can be scheduled.</li>
<li>Cron entries with arguments are now properly handled</li>
</ul>
<p>For plugin developers writing plugins using the WP-Cron system, this plugin is indispensable.  For WordPress users, WP-Crontrol reveals the secret life of your blog.  My series on <a href="http://scompt.com/archives/series/taking-control-of-wp-cron-using-wp-crontrol">taking control of the WordPress cron system</a> provides code and tips on how to best utilize WP-Crontrol.</p>
<p><a href="http://downloads.wordpress.org/plugin/wp-crontrol.1.0.zip">Download WP-Crontrol Version 1.0</a></p>
]]></content:encoded>
			<wfw:commentRss>http://scompt.com/blog/archives/2008/06/06/wp-crontrol-10-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get your WordPress series in your XML sitemap</title>
		<link>http://scompt.com/blog/archives/2008/05/25/get-your-wordpress-series-in-your-xml-sitemap</link>
		<comments>http://scompt.com/blog/archives/2008/05/25/get-your-wordpress-series-in-your-xml-sitemap#comments</comments>
		<pubDate>Sun, 25 May 2008 17:02:22 +0000</pubDate>
		<dc:creator>scompt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://scompt.com/?p=208</guid>
		<description><![CDATA[If you use the XML Sitemap Generator and Organize Series plugins for WordPress, then this is something you can use to get your series more noticed by Google and other search engines which pay attention to XML Sitemaps.  If you take a look in your sitemap (http://example.com/sitemap.xml), you&#8217;ll notice that the series that you&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>If you use the <a href="http://wordpress.org/extend/plugins/google-sitemap-generator/">XML Sitemap Generator</a> and <a href="http://wordpress.org/extend/plugins/organize-series/">Organize Series</a> plugins for <a href="http://wordpress.org">WordPress</a>, then this is something you can use to get your series more noticed by Google and other search engines which pay attention to <a href="http://www.sitemaps.org/">XML Sitemaps</a>.  If you take a look in your sitemap (http://example.com/sitemap.xml), you&#8217;ll notice that the series that you&#8217;ve been working hard to put together are no where to be seen.  That&#8217;s because you have to let the Sitemap Generator know about them.  The code snippet below, perfect for the <code>functions.php</code> file of your theme, will do just that.</p>
<p><span id="more-208"></span><br />
<code>
<pre name="code" class="php">add_action("sm_buildmap","scompt_series_sitemap");
function scompt_series_sitemap() {
    if( !class_exists(GoogleSitemapGenerator) ||
        !function_exists(get_series) ) return;
	$gen = &#038;GoogleSitemapGenerator::GetInstance();
	if($gen != null) {
	    $all_series = get_series();
        foreach( $all_series as $series ) {
            $gen->AddUrl( get_series_link($series->term_id) );
        }
	}
}</pre>
<p></code></p>
<p>I think the code is pretty self-explanatory.  Lines 3 and 4 make sure that all the necessary bits have been loaded.  Line 5 gets a copy of the object used to generate the sitemap and line 9 feeds it&#8217;s the URLs of your series pages.  The <code>AddUrl</code> method takes a couple extra parameters that let you define last changed date, change frequency, and priority if you want.</p>
]]></content:encoded>
			<wfw:commentRss>http://scompt.com/blog/archives/2008/05/25/get-your-wordpress-series-in-your-xml-sitemap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ImmerStat 0.5 Released</title>
		<link>http://scompt.com/blog/archives/2008/05/12/immerstat-05-released</link>
		<comments>http://scompt.com/blog/archives/2008/05/12/immerstat-05-released#comments</comments>
		<pubDate>Mon, 12 May 2008 08:01:43 +0000</pubDate>
		<dc:creator>scompt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[releases]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://scompt.com/?p=204</guid>
		<description><![CDATA[ImmerStat is a plugin I wrote over the weekend after getting tired of the Flash applet that displays statistics for the WordPress.com Stats plugin.  It&#8217;s overkill when I just want to get a general idea of where I&#8217;m sitting at the moment stats-wise.  ImmerStat gets rid of the WordPress.com Stats widget from the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://scompt.com/projects/immerstat">ImmerStat</a> is a plugin I wrote over the weekend after getting tired of the Flash applet that displays statistics for the <a href="http://wordpress.org/extend/plugins/stats/">WordPress.com Stats plugin</a>.  It&#8217;s overkill when I just want to get a general idea of where I&#8217;m sitting at the moment stats-wise.  ImmerStat gets rid of the WordPress.com Stats widget from the Dashboard and replaces it with an ever-present .PNG in the top-right corner of the admin screen.</p>
<p><span id="more-204"></span></p>
<p><a href='http://scompt.com/wordpress/wp-content/uploads/2008/05/immerstat.jpg'><img src="http://scompt.com/wordpress/wp-content/uploads/2008/05/immerstat-150x136.jpg" alt="" title="ImmerStat screenshot" width="150" height="136" class="alignright size-medium wp-image-205" /></a></p>
<p>The statistics are pulled using the same functions that the WordPress.com Stats plugin uses and are cached for 5 minutes, as are all stats from the plugin.  The graphic is created on the fly using the <a href="http://code.google.com/apis/chart/">Google Charts API</a>.  The plugin just build the URL and sends it to the browser.  Colors, timespan, and Google Charts parameters are all completely configurable using filter hooks.</p>
<p>WordPress 2.5 is the primary version supported.  Previous versions <strong>should</strong> work, but have not been tested.</p>
<p><a href="http://downloads.wordpress.org/plugin/immerstat.0.5.zip">Download ImmerStat Version 0.5</a></p>
]]></content:encoded>
			<wfw:commentRss>http://scompt.com/blog/archives/2008/05/12/immerstat-05-released/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Updating the Manage Posts Filtering for WordPress 2.5</title>
		<link>http://scompt.com/blog/archives/2008/05/03/updating-the-manage-posts-filtering-for-wordpress-25</link>
		<comments>http://scompt.com/blog/archives/2008/05/03/updating-the-manage-posts-filtering-for-wordpress-25#comments</comments>
		<pubDate>Sat, 03 May 2008 12:25:53 +0000</pubDate>
		<dc:creator>Edward Dale</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://scompt.com/?p=198</guid>
		<description><![CDATA[Since the last post on Custom Filtering in the Manage Posts Screen, WordPress 2.5 has been released to the world.  While the techniques discussed in that article are still valid, due to the big admin interface rewrite, the results don&#8217;t look as pretty as they could.  In this post, I&#8217;ll discuss updating the [...]]]></description>
			<content:encoded><![CDATA[<p>Since the last post on <a href="http://scompt.com/archives/2008/02/25/custom-filtering-in-the-wordpress-manage-posts-screen">Custom Filtering in the Manage Posts Screen</a>, <a href="http://codex.wordpress.org/Version_2.5">WordPress 2.5</a> has been released to the world.  While the techniques discussed in that article are still valid, due to the big admin interface rewrite, the results don&#8217;t look as pretty as they could.  In this post, I&#8217;ll discuss updating the code from the previous post so that it works <strong>and looks good</strong> through all modern WordPress versions.</p>
<p><span id="more-198"></span></p>
<h4>One quick note</h4>
<p>It appears that something changed in Version 2.5 that breaks the way that the <code>posts_where</code> hook was being attached.  Initially, the <code>admin_head</code> hook was being used to attach it.  This isn&#8217;t that great because it means the hook is loaded on all admin pages, which isn&#8217;t really necessary.  Also, as I said, it just doesn&#8217;t work in the new version of WordPress.  A better way, which replaces lines 21&mdash;24 in the code below is:<br />
<code>
<pre name="code" class="php">add_action('load-edit.php', 'scompt_load_edit_page');
function scompt_load_edit_page() {
    add_filter('posts_where', 'scompt_posts_where');
}</pre>
<p></code></p>
<h4>What we&#8217;re starting with</h4>
<div class="imageright">
<a href='/wordpress/wp-content/uploads/2008/05/version_compare.jpg' title='Comparison of WordPress 2.3 &amp; 2.5'><img src='/wordpress/wp-content/uploads/2008/05/version_compare-150x150.jpg' alt='Comparison of WordPress 2.3 &amp; 2.5' /></a></p>
<p>Comparison of WordPress 2.3 &amp; 2.5</p>
</div>
<p>Below is the code that we ended up with in the last post.  To the right, you&#8217;ll see a screenshot of how it looks in the WordPress 2.3 and 2.5.  WordPress 2.2 should look the same as 2.3, but it&#8217;s old enough that we&#8217;re not concerned with it.  There are a couple things worth noting in the image.</p>
<p>In WordPress 2.3, the dropdown fits with the other dropdowns.  That&#8217;s good.  Notice that there&#8217;s two &#8216;Filter&#8217; buttons.  That&#8217;s bad, but was necessary because the <code>restrict_manage_posts</code> hook is called outside of the form element.  In WordPress 2.5, there&#8217;s a stylish light-blue bar where the filters should go, and there&#8217;s our filter sitting out in the middle of nowhere.  Also, there&#8217;s no longer a border with label surrounding the dropdown.  The last thing to notice is that the text inside of the dropdown is different: &#8220;Any&#8221; compared to &#8220;Show all Dates&#8221; in the case of the date filter.  This leaves us with a nice TODO list of things to accomplish in this post:</p>
<ol>
<li>Get rid of the extra &#8216;Filter&#8217; button</li>
<li>Put the dropdown in the filter bar</li>
<li>Get rid of the border and label surrounding the dropdown</li>
<li>Make the text shown in the dropdown fit better with the other filters</li>
<li>Make sure it still works and looks good in WordPress 2.3</li>
</ol>
<p><code>
<pre name="code" class="php">add_action(&#x27;restrict_manage_posts&#x27;, &#x27;scompt_restrict_manage_posts&#x27;);
function scompt_restrict_manage_posts() {
    global $wpdb;
    $has_count = $wpdb-&gt;get_var(&quot;SELECT COUNT(*) FROM wp_posts WHERE post_type=&#x27;post&#x27; &quot;.
        &quot;AND ID IN (SELECT post_parent FROM wp_posts WHERE post_type=&#x27;attachment&#x27;)&quot;);
    $hasnt_count = $wpdb-&gt;get_var(&quot;SELECT COUNT(*) FROM wp_posts WHERE post_type=&#x27;post&#x27; &quot;.
        &quot;AND ID NOT IN (SELECT post_parent FROM wp_posts WHERE post_type=&#x27;attachment&#x27;)&quot;);
    ?&gt;
		&lt;form name=&quot;scompt_attachmentform&quot; id=&quot;scompt_attachmentform&quot; action=&quot;&quot; method=&quot;get&quot;&gt;
			&lt;fieldset style=&quot;margin: 0pt 1em 1em 1.5em; padding: 0pt; float: left;&quot;&gt;
    			&lt;legend&gt;&lt;?php _e(&#x27;Attachments&#x27;); ?&gt;&amp;hellip;&lt;/legend&gt;
    			&lt;select name=&#x27;scompt_attachments&#x27; id=&#x27;scompt_attachments&#x27; class=&#x27;postform&#x27;&gt;
        			&lt;option value=&quot;&quot;&gt;&lt;?php _e(&#x27;All&#x27;); ?&gt;&lt;/option&gt;
        			&lt;option value=&quot;has&quot; &lt;?php if( isset($_GET[&#x27;scompt_attachments&#x27;]) &amp;&amp; $_GET[&#x27;scompt_attachments&#x27;]==&#x27;has&#x27;) echo &#x27;selected=&quot;selected&quot;&#x27; ?&gt;&gt;&lt;?php _e(&#x27;Has attachments&#x27;); ?&gt;  (&lt;?php echo $has_count ?&gt;)&lt;/option&gt;
        			&lt;option value=&quot;hasnt&quot; &lt;?php if( isset($_GET[&#x27;scompt_attachments&#x27;]) &amp;&amp; $_GET[&#x27;scompt_attachments&#x27;]==&#x27;hasnt&#x27;) echo &#x27;selected=&quot;selected&quot;&#x27; ?&gt;&gt;&lt;?php _e(&#x27;Has no attachments&#x27;); ?&gt;  (&lt;?php echo $hasnt_count ?&gt;)&lt;/option&gt;
        		&lt;/select&gt;
			&lt;/fieldset&gt;
			&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;&lt;?php _e(&#x27;Filter &amp;#187;&#x27;); ?&gt;&quot; class=&quot;button&quot; style=&quot;float:left;margin:14px 0pt 1em;position:relative;top:0.35em;&quot;/&gt;
		&lt;/form&gt;
	&lt;?php
}

add_action(&#x27;admin_head&#x27;, &#x27;scompt_admin_head&#x27;);
function scompt_admin_head() {
    add_filter(&#x27;posts_where&#x27;, &#x27;scompt_posts_where&#x27;);
}
function scompt_posts_where($where) {
    global $wpdb;
    if( $_GET[&#x27;scompt_attachments&#x27;] == &#x27;has&#x27; ) {
        $where .= &quot; AND ID IN (SELECT post_parent FROM {$wpdb-&gt;posts} WHERE post_type=&#x27;attachment&#x27; )&quot;;
    } else if( $_GET[&#x27;scompt_attachments&#x27;] == &#x27;hasnt&#x27; ) {
        $where .= &quot; AND ID NOT IN (SELECT post_parent FROM {$wpdb-&gt;posts} WHERE post_type=&#x27;attachment&#x27; )&quot;;
    }
    return $where;
}</pre>
<p></code></p>
<h4>Getting down to work</h4>
<p>I would suggest that we just head straight down our TODO list.  The first point is to get rid of the &#8216;Filter&#8217; button.  Luckily, the <code>restrict_manage_posts</code> hook is called <strong>inside</strong> the form in version 2.5, eliminating the need for it.  This also means that we can leave out the <code>form</code> tag that was previously necessary.  In summary, cut out lines 9, 18, and 19.</p>
<p>The second point and third points can be solved together.  The reason the dropdown is getting shoved outside the filter bar is actually <em>because</em> of the border and label that we wanted to get rid of anyway.  This means not printing the <code>fieldset</code> and <code>label</code> tags, so we can get rid of lines 10, 11, and 17.  You&#8217;ll notice that out code is getting whittled away pretty quickly.  That&#8217;s what I call progress.</p>
<p>The fourth point is a logical consequence of the previous one.  There&#8217;s no longer a label describing what the dropdown does, so now the text inside the dropdown has to do so.  Previously, our label was &#8220;Attachments&#8221; and the dropdown text was &#8220;All&#8221;.  Now, we need to come up with a phrase that captures the essence of the two former phrases.  The best I could come up with is &#8220;View with/without attachments&#8221;, which needs to be changed in line 13.  Leave a comment if you have a better idea.  This label will go inside the default first option in the dropdown.</p>
<div class="imageright">
<a href='/wordpress/wp-content/uploads/2008/05/filtering_posts_25.jpg' title='Posts filtering on 2.5'><img src='/wordpress/wp-content/uploads/2008/05/filtering_posts_25-150x99.jpg' alt='Posts filtering on 2.5' /></a></p>
<p>Posts filtering on 2.5</p>
</div>
<p>At this point, having addressed the first four points, we have a working chunk of code for WordPress 2.5.  Below is the updated copy of the <code>scompt_restrict_manage_posts</code> function and to the right a screenshot of the results.  We&#8217;ll hit the last point in the next section.</p>
<p><code>
<pre name="code" class="php">function scompt_restrict_manage_posts() {
    global $wpdb, $wp_version;
    $has_count = $wpdb-&gt;get_var(&quot;SELECT COUNT(*) FROM wp_posts WHERE post_type=&#x27;post&#x27; &quot;.
        &quot;AND ID IN (SELECT post_parent FROM wp_posts WHERE post_type=&#x27;attachment&#x27;)&quot;);
    $hasnt_count = $wpdb-&gt;get_var(&quot;SELECT COUNT(*) FROM wp_posts WHERE post_type=&#x27;post&#x27; &quot;.
        &quot;AND ID NOT IN (SELECT post_parent FROM wp_posts WHERE post_type=&#x27;attachment&#x27;)&quot;);

    ?&gt;
	&lt;select name=&#x27;scompt_attachments&#x27; id=&#x27;scompt_attachments&#x27; class=&#x27;postform&#x27;&gt;
		&lt;option value=&quot;0&quot;&gt;&lt;?php _e(&#x27;View with/without attachments&#x27;) ?&gt;&lt;/option&gt;
		&lt;option value=&quot;has&quot; &lt;?php if( isset($_GET[&#x27;scompt_attachments&#x27;]) &amp;&amp; $_GET[&#x27;scompt_attachments&#x27;]==&#x27;has&#x27;) echo &#x27;selected=&quot;selected&quot;&#x27; ?&gt;&gt;&lt;?php _e(&#x27;Has attachments&#x27;); ?&gt;  (&lt;?php echo $has_count ?&gt;)&lt;/option&gt;
		&lt;option value=&quot;hasnt&quot; &lt;?php if( isset($_GET[&#x27;scompt_attachments&#x27;]) &amp;&amp; $_GET[&#x27;scompt_attachments&#x27;]==&#x27;hasnt&#x27;) echo &#x27;selected=&quot;selected&quot;&#x27; ?&gt;&gt;&lt;?php _e(&#x27;Has no attachments&#x27;); ?&gt;  (&lt;?php echo $hasnt_count ?&gt;)&lt;/option&gt;
	&lt;/select&gt;
	&lt;?php
}</pre>
<p></code></p>
<h4>Backwards Compatibility</h4>
<p>Now that we&#8217;ve shrunk our code down to it&#8217;s 2.5 essentials, it&#8217;s time to balloon it back up again to make it backward-compatible with 2.3.  If you&#8217;re running 2.5 and don&#8217;t plan on looking back anytime soon, you can skip this section and still live a happy life.</p>
<p>The first step is being able to differentiate between version 2.3 and 2.5.  To do this, we&#8217;ll take advantage of the PHP function <code>version_compare</code> and the WordPress global <code>$wp_version</code> which comes from <code>wp-includes/version.php</code>.  Putting those together, we get the following useful bit:</p>
<p><code>
<pre name="code" class="php">if( version_compare( $wp_version, '2.5', '<' ) ) {
    // Versions before 2.5
} else {
    // Version 2.5 and later
}</pre>
<p></code></p>
<p>Because our 2.5 code is essentially the 2.3 code wrapped in a couple tags (<code>form</code> and <code>fieldset</code>) with a couple extras thrown in at the beginning and end (<code>legend</code> and <code>input</code>), I would suggest making variables to hold these extra <code>$before</code> and <code>$after</code> bits.  For version 2.5, these variables will be empty.  The only other difference is the verbage in the dropdown.  Here's the final code that will work well and look good for WordPress versions 2.2 &mdash; 2.5.</p>
<p><code>
<pre name="code" class="php">function scompt_restrict_manage_posts() {
    global $wpdb, $wp_version;
    $has_count = $wpdb-&gt;get_var(&quot;SELECT COUNT(*) FROM wp_posts WHERE post_type=&#x27;post&#x27; &quot;.
        &quot;AND ID IN (SELECT post_parent FROM wp_posts WHERE post_type=&#x27;attachment&#x27;)&quot;);
    $hasnt_count = $wpdb-&gt;get_var(&quot;SELECT COUNT(*) FROM wp_posts WHERE post_type=&#x27;post&#x27; &quot;.
        &quot;AND ID NOT IN (SELECT post_parent FROM wp_posts WHERE post_type=&#x27;attachment&#x27;)&quot;);

    if( version_compare( $wp_version, &#x27;2.5&#x27;, &#x27;&lt;&#x27; ) ) {
        $before  = &#x27;&lt;form name=&quot;scompt_attachmentform&quot; id=&quot;scompt_attachmentform&quot; action=&quot;&quot; method=&quot;get&quot;&gt;&#x27;;
        $before .= &#x27;&lt;fieldset style=&quot;margin: 0pt 1em 1em 1.5em; padding: 0pt; float: left;&quot;&gt;&#x27;;
        $before .= &#x27;&lt;legend&gt;&#x27;. __(&#x27;Attachments&#x27;) .&#x27;&amp;hellip;&lt;/legend&gt;&#x27;;
        $all = __(&#x27;All&#x27;);
        $after  = &#x27;&lt;/fieldset&gt;&#x27;;
        $after .= &#x27;&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;&#x27;. __(&#x27;Filter &amp;#187;&#x27;) .&#x27;&quot; class=&quot;button&quot; style=&quot;float:left;margin:14px 0pt 1em;position:relative;top:0.35em;&quot;/&gt;&#x27;;
        $after .= &#x27;&lt;/form&gt;&#x27;;
    } else {
        $before = &quot;&quot;;
        $all = __(&#x27;View with/without attachments&#x27;);
        $after = &quot;&quot;;
    }
    echo $before;
    ?&gt;
	&lt;select name=&#x27;scompt_attachments&#x27; id=&#x27;scompt_attachments&#x27; class=&#x27;postform&#x27;&gt;
		&lt;option value=&quot;0&quot;&gt;&lt;?php echo $all; ?&gt;&lt;/option&gt;
		&lt;option value=&quot;has&quot; &lt;?php if( isset($_GET[&#x27;scompt_attachments&#x27;]) &amp;&amp; $_GET[&#x27;scompt_attachments&#x27;]==&#x27;has&#x27;) echo &#x27;selected=&quot;selected&quot;&#x27; ?&gt;&gt;&lt;?php _e(&#x27;Has attachments&#x27;); ?&gt;  (&lt;?php echo $has_count ?&gt;)&lt;/option&gt;
		&lt;option value=&quot;hasnt&quot; &lt;?php if( isset($_GET[&#x27;scompt_attachments&#x27;]) &amp;&amp; $_GET[&#x27;scompt_attachments&#x27;]==&#x27;hasnt&#x27;) echo &#x27;selected=&quot;selected&quot;&#x27; ?&gt;&gt;&lt;?php _e(&#x27;Has no attachments&#x27;); ?&gt;  (&lt;?php echo $hasnt_count ?&gt;)&lt;/option&gt;
	&lt;/select&gt;
	&lt;?php
	echo $after;
}

add_action(&#x27;load-edit.php&#x27;, &#x27;scompt_init_attachments&#x27;);
function scompt_init_attachments() {
    add_filter(&#x27;posts_where&#x27;, &#x27;scompt_posts_where&#x27;);
    add_action(&#x27;restrict_manage_posts&#x27;, &#x27;scompt_restrict_manage_posts&#x27;);
}
function scompt_posts_where($where) {
    global $wpdb;
    if( $_GET[&#x27;scompt_attachments&#x27;] == &#x27;has&#x27; ) {
        $where .= &quot; AND ID IN (SELECT post_parent FROM {$wpdb-&gt;posts} WHERE post_type=&#x27;attachment&#x27; )&quot;;
    } else if( $_GET[&#x27;scompt_attachments&#x27;] == &#x27;hasnt&#x27; ) {
        $where .= &quot; AND ID NOT IN (SELECT post_parent FROM {$wpdb-&gt;posts} WHERE post_type=&#x27;attachment&#x27; )&quot;;
    }
    return $where;
}</pre>
<p></code></p>
<h4>Conclusion</h4>
<p>We've now successfully updated the Manage Posts filtering code for WordPress 2.5.  In the process, we even made it backward compatible.  This has been another post in my series on <a href="http://scompt.com/archives/series/pimp-my-manage-panel">Pimping your Manage Panel</a>.  Keep an eye peeled here for when I present my ever-promised technique of filtering in the Manage Pages panel.</p>
<h4>Update!</h4>
<p>One thing I forgot to mention.  In WordPress 2.5, the <code>restrict_manage_posts</code> hook is also used on the upload screen.  To make sure your dropdown code doesn't appear on the upload screen, make sure you add the <code>restrict_manage_posts</code> action inside the <code>scompt_init_attachments</code> hook.  This will make sure it only gets loaded when <code>edit.php</code> is called.  I've made the change on the above code snip</p>
]]></content:encoded>
			<wfw:commentRss>http://scompt.com/blog/archives/2008/05/03/updating-the-manage-posts-filtering-for-wordpress-25/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<series:name><![CDATA[Pimp my Manage panel]]></series:name>
	</item>
	</channel>
</rss>
