New Plugin: Easy Delete Revisions

Yesterday I had some free time, so I wrapped up new plugin to delete post revisions, if you aren’t using and forgot to disable them. Yes I know there already are similar plugins in .org repository, but some of them offer unnecessary options, others are outdated. So here’s my new plugin – Easy Delete Revisions

P.S. I hope my relation with revisions would change after 3.6, new UI looks really good.

More Social Features for Plugin Repository

I wish plugin repository had more social staff, like ability to follow developers. That would make quality plugin search process easier. Imagine, you could narrow down the search results to plugin author, which you’re following.

What other social features would you love to see in plugin repository?

Use of Meta boxes

Meta boxes are not used to divide a screen into sections visually. (An exception would be the Link Manager, which is very old and shouldn’t be used as a guideline.) They’re designed to provide flexible layouts for the post and dashboard screens.

Andrew Nacin, WordPress Core Developer.

Great description for meta boxes use.

The Dream Intership

Almost two weeks ago Automattic’s VIP team announced about summer internship.

Since then I’m thinking what can I do in a scope of proposed partnership. My first idea was WordPress media library, many folks around our community feel bad about media library, so I would love to spend my summer making small improvements to it.

Got my second idea few days ago when Daniel Bachhuber tweeted this:

This is a really cool idea and I would love to spent my summer dream internship working on this, under mentorship of Daniel and other VIP team members.

The ‘all’ hook

While checking links from Lance Willett‘s WordCamp San Diego talk, found reference to post by Nacin “5 Ways to Debug WordPress“, that I read while ago, where Nacin suggests using ‘all’ and ‘shutdown’ hooks for debugging. Found those methods very hand, especially ‘all’ hook, which fires for every action and filter and to quote Nacin:

You’ll be surprised how many hooks get executed on every page load. Good for troubleshooting and identifying the right hook.

Here’s code snippet you can put somewhere in you development/debugging plugin.

add_action( 'all', create_function( '', 'var_dump( current_filter() );' ) );

Lance’s talk from WordCamp San Diego – Theme Busters R Us

Add parent category class to post_class()

Right way to add class to post container HTML tag is post_class() function, it’s also required by Theme Review Guidelines.

Many people ask on WordPress – Stack Exchange how to echo class depending on parent category, best way to do this is to use post_class filter, so I wrote small chunk of code to this.

Following code is based on Chip Bennett’s clever solution. I changed big part of it, but logic is the same.

* Add parent category class to post_class() function
* @link
function mamaduka_add_parent_category_class( $classes, $class, $post_id ) {
foreach ( (array) get_the_category( $post_id ) as $cat ) {
if ( ! empty( $cat->parent ) ) {
$parent_cat = &get_category( $cat->parent );
$classes[] = 'category-parent-' . sanitize_html_class( $parent_cat->slug, $parent_cat->term_id );
} else {
$classes[] = 'category-parent-' . sanitize_html_class( $cat->slug, $cat->term_id );
return $classes;
add_filter( 'post_class', 'mamaduka_add_parent_category_class', 10, 3 );

view raw
hosted with ❤ by GitHub

What the code above does is simple, it gets array of category objects assigned to the post, then if category has parent it adds class ‘category-parent-{parent-cat-name}’, otherwise category is top-level so we are using it.

Problem: If user adds both parent and its child categories, we’ll get duplicated class output of parent category.

This is small problem I’m working now, any suggestions are welcome.