A look at WordPress 3.0 custom post types

March 25, 2010 | No Comments Yet

kovshenin.com discusses one of the many new features coming in WordPress 3.0 that will raise its bar as a publishing platform: custom post types.

So what else could be done with WordPress’ Custom Post Types? Well, basically anything. Say you run an online store which of course has some static Pages (such as Contact, About, etc), some blog Posts, cause we’re so 2.0, remember? And Products, which would be a custom post type that contains the product name, description, product price, stock availability, and could even contain inquiries in forms of user comments!

He covers two key code snippets that gets the ball rolling on custom post types: register_post_type (WPEngineer has a great post on it) and custom functions for the edit post screen columns, which are added via a filter and an action:

The action outputs custom columns depending on the type, while the filter simply defines the columns for the Podcasts post type. It’s as simple as that. Note that I trimmed the code a little bit to fit on screen, so you shouldn’t be simply outputing 63:50, but actually count the podcast length 😉

Looks quite simple for those who know their way around PHP, but I expect plugins (and perhaps future releases of WordPress) to integrate interfaces for setting up and customizing post types.

Leave a Comment | Tags: , , , , , , , ,

WordPress Plugin: My Snippets

December 7, 2009 | No Comments Yet

My Snippets lets you add custom widgets depending on the post displayed. It adds a custom meta box where you can add text or code, which shows up in your widget areas.

What I wanted was something that allowed me to control widget content from the post editor, so I wouldn’t have to worry about setting my widgets. This gave me the idea for the My Snippets plugin.

What this plugin does is add an extra meta box on the post editor that allows you to input custom content. This content is then displayed using the Snippet widget in any widget area you choose.

This is a really neat idea for making your website more dynamic. Combined with a theme that has lots of widgetized areas, this could very well change the way people compose and add extra information like videos, graphs, or quotes to their blog posts.

Question is, would it be possible to add the meta content to your feed? Because RSS readers certainly shouldn’t be exempt from them. Or perhaps create shortcodes for inserting them into the post editor, but only make them appear in-text if it’s in the feed, and in the widget areas otherwise. Just a suggestion though! There are probably many other uses for this plugin that people can come up with.

Download My Snippets

Leave a Comment | Tags: , , , ,