188 PART III • Using Plugins with WordPress
Figure 7-4: The Smashing Post type.
Content from custom post types won’t show up in the regular content flow; you’ll have to alter
the loop (with query_post() or something similar — see Chapter 3 for more about the
loop) to get content from custom post types to show up. However, if you have enabled it,
there’s nothing that stops you from linking to an archive page from a menu, for example.
There are a lot of options available when creating your post type. You can consult the
Codex for all of them at http://codex.wordpress.org/Function_Reference/
register_post_type. You’ll use custom post types for projects in Chapter 14, so look for
more on what you can do with them there.
So how would a custom post type look in a plugin? Pretty much the same as the custom
taxonomy. Here’s the Smashing Post Type plugin in all its splendor:
<?php
/*
Plugin Name: Smashing Post Type
Plugin URI: http://tdh.me/wordpress/smashing-post-type/
Description: Adding the Smashing Post Type.
Version: 1.0
Author: Thord Daniel Hedengren
Author URI: http://tdh.me/
*/
// Add to init hook
add_action( 'init', 'smashing_post_types' );
// Add these custom post types
function smashing_post_types() {
// Register Smashing Post Type
register_post_type( 'smashing_post_type',