Simply Exclude version 2.0 officially released

I’ve decided to finally commit the version 2.0 code base to the WordPress.org plugin repository. You can download or update your existing version http://wordpress.org/extend/plugins/simply-exclude/

You can read all the details of the update via the main plugin page on this site.

My compare of Windows 7 Operating System

I’m purchasing a new Apple MacBook Pro laptop for my end of the year tax credit. Plus since my current laptop is more than three years old and I depend on it for my business I wanted something with a warranty. Since this new laptop will have almost triple the drive space (750G) as my current one (200G) I’m looking to also purchase Windows 7 to run under a virtual engine like VMWare or Parallels.

So I jumped to the Microsoft site. Found the Windows 7 part of the site. I was looking for some quick comparison between the three different versions of the operating system. But was not able to find anything. This really makes me appreciate OS X which is really just one version. And damn cheaper!

So I decided to Google for more information. Found the BestBuy.com site. As this will probably be the store I make the purchase from I drilled through to the website page. The BestBuy.com site does have a nice popup comparison chart on the differences between Home Premium, Professional and Ultimate version of Windows 7.

Chart from BestBuy.com showing differences between Windows 7 versions

What I find really strange (and the reason I’m taking the time to write this) is some of the descriptions. Like the first line “Manage the things you do every day with improved desktop navigation”. Um, I’m sorry but should’t that actually be a given? Or the 5th line “Easy to create a home network and connect your PCs to a printer with HomeGroup”. Again I’m stunned. No thanks I would like the other version of your operating system which does not make setting up a home network easy. Thank You sir, Can I have another?

Give me a break. Maybe I’m just a Apple snob (don’t call me a fanboy). Over the last 6 years I’ve really come to appreciate the streamline marketing done for Apple. No hype and no marketing double-speak.

This is getting annoying…iPhone 4S predictions and disappointments

Dear Tech Media industry leaders. Please STOP building up rumors for weeks months about new technologies then act so disappointed when the company’s released item does not live up to your expectations.

Case in point the newly released Apple iPhone 4S. For weeks and months I’ve been pretty much spammed by repeated speculation on the upcoming new iPhone 4S/5 but most of the tech centric media engines. Plus, as is standard acceptable form these days, a story posted on one tech media site will be pilfered and repeated verbatim by another source as new news. Hate the fact that my feed reader think these are separate stories.

Now the day has come that Apple has finally revealed the new iPhone 4S. Hooray! Now, acting like petulant children the day after Christmas, you seem fit to slam Apple that they have lost their innovative edge. Really? Let me see you actually produce something you F*CKS. Really in my own opinion Apple couple have gone the path of lesser companies and given you a newly designed package so it is at least different than the previous iPhone 4 model and not change a thing about the internals of the device. But no Apple did the right thing and kept the outside aesthetics of the device the same but upgrade and improved the internals making it a step better than the current model. Boo for you that you speculation and constant spinning of lies didn’t pan out.

For the record I’m not disappointed in the new iPhone 4S. Will I upgrade to the new device? Probably not since I just upgraded to the iPhone 4 this past summer due to my contract cycle.

Adding Custom Columns to WordPress Post listing

In a reader comment one of my previous posts about “Adding columns to Taxonomy tables”. The commenter asks how to add columns to a normal Posts listing.

Well, readers here is the simple solutions. There are basically 2 hooks. One is a filter. The other an action. Below are examples of how to setup these hooks. I explain the details below the code listing.


<?php
add_filter( 'manage_edit-post_columns', 'admin_post_header_columns', 10, 1);
add_action( 'manage_posts_custom_column', 'admin_post_data_row', 10, 2);
function admin_post_header_columns($columns)
{
if (!isset($columns['note']))
$columns['note'] = "Notes";
return $columns;
}
function admin_post_data_row($column_name, $post_id)
{
switch($column_name)
{
case 'note':
// Logic to display post 'Note' field information here.
// $post_note = get_post_meta($post_id, 'note', true);
//if ($post_note) echo $post_note;
break;
default:
break;
}
}

So what are these filters/actions function?

The first line, add_filter( ‘manage_edit-post_columns’… sets up a filter. This filter adds the new column to the listing. This filter is called only once when the page is loaded. Since this is a Filter WordPress will call our function ‘admin_post_header_columns’ and pass in a parameter. In this case the parameter is an array of columns. As part of our function we can change/add/delete items from the array then we MUST return the array. In our simple example all we are doing is adding an item to the array for our ‘Notes’ columns. As with any PHP array we assign a key to be ‘note’ and the column label ‘Notes’. Then return the array back to WP.

A note about the filter name. Notice we setup the filter as using the first parameter ‘manage_edit-post_columns’. Keep in mind this filter is specific to Posts. If you wanted to do this same thing for Pages you would instead use ‘manage_pages_columns’. Or if you were using a custom post type the value would be ‘manage_{$post_type}_posts_columns’ where ‘{$post_type}’ is your post_type. For example if we register a new post_type Products with the key ‘products’ then the filter would use the parameter of ‘manage_products_posts_columns’. On to the second hook. The action.

The second line of our code registers an action. While the previous filter added the column to the listing. This action gets called for each row of the displayed posts to display the contents in the row cell for that column. In WordPress an action is different than a filter in that your function may be passed some optional parameters but you are not expected to return any values. For our purpose we setup an action to the hook ‘manage_posts_custom_column’ which will call our function ‘admin_post_data_row’.

Inside our function we setup a case statement to switch on the column name. In our instance we only want to effect the ‘note’ column. This ‘note’ value is the array ‘key’ we defined in our previous filter function.

Back to the action hook registration. Notice the third and fourth parameters on this action registration call. The third parameter tells WordPress the priority of this hook o when to process it in relation to other hooks. A lower number means sooner a higher number means later. We set this to ’10’ which is a default value. The fourth parameter tells WordPress how many arguments to pass to our function. By default there will be only one argument, the column name. But since each row (post item) will have different values we need the second parameter which in this case is the ID of the post so we can look up the related custom field.

Also, like the filter hook where we setup the column there are different filters to call based on if you are using this on Pages, Posts or some custom post_type. In our case we are adding the column to the Posts listing so the first parameter of our hook is ‘manage_posts_custom_column’. If we were adding a column to Pages the parameter would instead be ‘manage_pages_custom_column’. And if we were adding this column to a custom post_type the parameter would be ‘manage_{$post->post_type}_posts_custom_column’ where ‘{$post->post_type}’ is the key to our registered post_type.

I hope this helps with a deeper understanding of WordPress and an appreciation of the wonderful world of WordPress actions and filters.

Pages-Children 1.5 released

Over the last week I’ve released 3 versions of my popular Pages-Children plugin.

Here is a breakdown of the changes.

1.3.1 – Fixed issues is plugin which were effecting the Media Library listing. As far as I can tell this was related to the update in WordPress 3.1.3

1.4 – Added support for any hierarchical post type. Previous versions of the plugin only worked for the default Pages. Now if you have any custom post type defined hierarchical you can have better formatting of the output.

1. 5 – In the previous version (1.4) I added support for custom post types. In this latest version I’ve added support for hierarchical taxonomies as well. Here is an example of a terms listing showing the breadcrumbs and navigation to ‘children’.

To comment or report an issue regarding this plugin please see the main project page for Pages-Children