Topics Covered in This WordPress Tutorial:
Adding Thumbnail Support (post-thumbnails), Creating a Custom Post Type, Registering Taxonomy
Tutorial Prerequisites
Custom post types were introduced in WordPress 3.0
Required for registering custom post types and taxonomies
Helpful for understanding the registration functions and parameters
Exercise Preview

WordPress Content Evolution
Pre-WordPress 3.0
Limited to pages and posts only, restrictive for complex CMS usage
WordPress 3.0 Release
Introduced custom post types, enabling complex content management
Modern WordPress
Full CMS capabilities with custom post types, taxonomies, and fields
Exercise Overview
Prior to WordPress 3.0's release in 2010, developers were constrained to using only pages and posts for content management. This limitation severely hindered WordPress's potential as a comprehensive content management system, relegating it primarily to blogging applications. The introduction of custom post types in WordPress 3.0 revolutionized content organization, transforming WordPress into a truly flexible CMS platform that powers over 40% of the web today.
Custom post types unlock sophisticated content architecture possibilities. They feature dedicated Dashboard menus, customizable interface layouts, and granular content control that enables you to structure your site's information hierarchy precisely as your project demands. Whether you're building an e-commerce platform, portfolio site, or complex enterprise application, custom post types provide the foundation for scalable content management.
In this hands-on exercise, you'll construct a custom post type specifically designed for automotive content. This "Cars" post type will integrate seamlessly into your Dashboard workflow, allowing you to manage vehicle listings with the same intuitive interface you use for standard posts and pages. Additionally, you'll implement a custom taxonomy system to categorize cars by their sales status—whether they're actively for sale, already sold, or featured prominently. This taxonomy approach demonstrates how professional developers organize and filter content dynamically, a crucial skill for building sophisticated WordPress applications.
Project Implementation Steps
Create Cars Post Type
Register a custom post type called 'cars' with appropriate labels and settings for automotive content management
Add Thumbnail Support
Enable post thumbnail functionality with specific dimensions (223x140 pixels) for car image displays
Register Status Taxonomy
Create a hierarchical taxonomy to classify cars as 'For Sale', 'Sold', or 'Featured'
Configure Dashboard Interface
Set up custom menu items and interface elements for managing car listings in WordPress admin
If You Did Not Do the Previous Exercise
- In a web browser, go to localhost:8888/lamdm/wp-admin (Mac) or localhost/lamdm/wp-admin (Windows) and log in if prompted.
- On the left of the Dashboard, mouse over Appearance and click Themes.
- Click the Add New button.
- Click the Upload link, then the Browse (or Choose File) button.
- Navigate to Desktop > Class Files > WordPress.org Class and double–click landmTheme-ready-for-custom-post-types.zip to open it.
- Click Install Now, then click Activate.
Registering a Custom Post Type
Custom post types must be registered through WordPress's functions.php file to integrate properly with the core system. This registration process tells WordPress how to handle your custom content type, defining its behavior, capabilities, and Dashboard presentation. Let's begin by implementing the foundational code structure.
Switch to your code editor.
Open functions.php from the landmTheme folder (will be landmTheme-ready-for-custom-post-types if you didn't do the previous exercise).
At the end of functions.php, just before the closing ?
>, add the following:/* Add support for thumbnails */ add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 223,140, true );The add_theme_support
()function activates WordPress's built-in featured image functionality for your theme. The set_post_thumbnail_size()function establishes standardized dimensions for thumbnail generation—in this case, 223 x 140 pixels with hard cropping enabled. This ensures consistent image presentation across your automotive listings, which is crucial for professional-looking inventory displays. The hard crop parameter (true) maintains exact dimensions by cropping excess image area rather than distorting proportions.At the end of functions.php, just before the closing ?
>, add the following:/* Registering the Cars custom post type */ add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type(); };This code establishes the WordPress hook system integration for your custom post type. The add_action
()function connects your create_post_type()function to WordPress's init action hook, which fires after WordPress completes its core loading sequence but before generating any output. This timing ensures your custom post type is available throughout the entire request lifecycle. The register_post_type()function currently lacks arguments, which we'll address in the next steps to define your post type's specific characteristics and capabilities.To save some time, we have already typed up the arguments for you. Open arguments.txt from the Class Files > WordPress.org Class > landm Content folder.
Select all the code and copy it.
Hit Cmd–W (Mac) or CTRL–W (Windows) to close the file but not the folder.
Switch back to functions.php if you're not already there.
Click inside the parentheses of register_post_type
().Hit Return (Mac) or Enter (Windows) twice to add some space between the parentheses.
In the new line you just added, paste in the arguments. It should look like the following (you may need to clean it up a bit so the indentation is easier to read):
function create_post_type() { register_post_type( 'cars', array( 'labels' => array( 'name' => __('Cars'), 'singular_name' => __('Car'), 'add_new_item' => __('Add New Car'), 'edit_item' => __('Edit Car'), ), 'public' => true, 'hierarchical' => false, 'rewrite' => array( 'slug' => 'cars'), 'supports' => array('title', 'thumbnail', 'editor', 'excerpt', 'custom-fields', 'author') ) ); };The register_post_type
()function accepts two critical parameters:$post_type (the internal identifier) and$args (configuration array). The identifier 'cars' serves as WordPress's internal reference for this post type—choose identifiers carefully as they're difficult to change after content creation. The arguments array defines your post type's behavior and presentation:labels: Defines the human-readable text displayed throughout the WordPress admin interface. These labels appear in menus, buttons, and page titles, ensuring a consistent user experience. public: Controls visibility in both the admin Dashboard and frontend queries. Setting this to true makes your post type fully accessible and queryable. For internal-only post types, set this to false. hierarchical: Determines content structure behavior. False creates a post-like structure (flat, chronological), while true enables page-like parent-child relationships. Most custom post types work best as non-hierarchical. rewrite: Customizes the URL structure for your post type. This creates SEO-friendly permalinks like yoursite.com/cars/honda-accord instead of generic parameter-based URLs. supports: Enables specific editing features in the admin interface. This modular approach lets you include only the functionality your content type actually needs, creating cleaner editing experiences. Save the file.
- Now let's verify your custom post type integration with WordPress. Navigate to your local development environment:
- Mac: localhost:8888/landm/wp-admin
- Windows: localhost/landm/wp-admin
Log in if necessary.
Examine the left sidebar navigation—you'll notice a new "Cars" menu item. Hover over Cars to reveal the submenu options. This demonstrates how WordPress automatically generates admin interface elements based on your post type registration, providing the same professional experience as built-in post types.

Under Cars, click Add New to explore the editing interface.
The interface looks professional and functional, but you'll notice an unnecessary Author module at the bottom. Since automotive listings don't typically require author attribution, let's refine the interface by removing this module.
Return to functions.php in your code editor.
In the supports parameter array, remove
'author'and its preceding comma so the line reads:'supports' => array('title', 'thumbnail', 'editor', 'excerpt', 'custom-fields')Save your changes.
Return to the WordPress Dashboard.
Navigate to Cars > Add New again.
Confirm that the Author module has been removed, creating a cleaner, more focused editing experience tailored specifically for automotive content.
All custom post type registration must be done in your theme's functions.php file. This ensures the post type is available whenever the theme is active.
Key Registration Parameters
Labels Array
Defines how the post type appears in the WordPress admin interface. Includes singular, plural, and action-specific labels.
Public Setting
Controls visibility in the admin dashboard and frontend. Must be set to true for the post type to appear.
Supports Array
Specifies which meta boxes and features are available: title, editor, thumbnail, excerpt, custom fields.
Registering a Taxonomy
Taxonomies provide the organizational structure that transforms your custom post type from a simple content repository into a sophisticated, filterable system. While WordPress includes built-in taxonomies like categories and tags for posts, custom post types benefit from purpose-built taxonomies that reflect your specific content needs. For automotive listings, a status taxonomy enables dynamic content filtering—essential for creating "Featured Cars," "Available Inventory," and "Sold Vehicles" sections that update automatically based on your categorization.
Return to functions.php in your code editor.
At the end of functions.php, just before the closing ?
>, add the following:/* Registering Custom Taxonomies */ add_action( 'init', 'create_status_taxonomy' ); function create_status_taxonomy() { register_taxonomy(); }This follows the same hook pattern established for your custom post type registration. The create_status_taxonomy
()function hooks into WordPress's init action, ensuring your taxonomy is available when WordPress processes queries and generates content. The register_taxonomy()function will define how your status system integrates with your Cars post type.Replace the empty register_taxonomy
()function with the following complete implementation:function create_status_taxonomy() { register_taxonomy( 'status', array('cars'), array( 'label' => __('Status'), 'hierarchical' => true, ) ); }The register_taxonomy
()function requires three parameters for complete implementation. The first parameter,$taxonomy, establishes the internal identifier ('status'). The second parameter,$object_type, connects your taxonomy to specific post types through an array—in this case, array('cars'). This design allows taxonomies to work across multiple post types if needed. The final parameter defines taxonomy behavior:label: Sets the display name visible throughout the WordPress admin interface. This appears in meta boxes, admin menus, and management screens. hierarchical: Controls whether terms can have parent-child relationships (like categories) or remain flat (like tags). Hierarchical taxonomies enable nested organization structures for complex categorization needs. Save the file to register your new taxonomy with WordPress.
Hierarchical vs Non-Hierarchical Taxonomies
| Feature | Hierarchical (Categories) | Non-Hierarchical (Tags) |
|---|---|---|
| Structure | Parent-child relationships | Flat structure |
| Interface | Checkbox selection | Text input field |
| Use Case | Organized classification | Flexible labeling |
| Example | Car Status: For Sale > Featured | Keywords: luxury, sedan, automatic |
Adding Taxonomies
With your custom taxonomy registered, it's time to populate it with the specific status terms that will drive your automotive site's content organization. These status categories will serve as the foundation for dynamic content filtering in future exercises, enabling you to create automatically updating sections for different types of vehicle listings.
Navigate to your WordPress Dashboard.
In the left sidebar, hover over Cars and click the newly available Status link. This demonstrates how WordPress automatically generates management interfaces for your custom taxonomies.
Create your first status category by entering the following information:
Name: For Sale Slug: for-sale Parent: None Description: Leave it blank Click the Add New Category button to create this status term.
Repeat this process to create two additional status categories: Sold (slug: sold) and Featured (slug: featured). These three status types provide comprehensive coverage for typical automotive inventory management needs.
Your custom post type and taxonomy system is now operational and ready for content creation. In the following exercise, you'll learn how to leverage these organizational tools to create dynamic, automatically filtered content displays that respond to your categorization choices.
Car Status Categories Structure
These status taxonomies will enable dynamic page content in future exercises, allowing automatic filtering and display of cars based on their status classification.