WordPress plugin intelligence profile

GigaOM Custom Post Type Factory

Makes defining custom post types as easy as creating a widget. Includes example code to get you started.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 3.4
Current versiona1
WordPress coverageTested up to WordPress 3.4
Minimum stackWP 3.3 · PHP —
Directory statusactive
Last directory update13 Aug 201214y ago
Active installationsNewAdoption metric — not a quality score
WordPress.org ratingNo WordPress.org ratings yet
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records GigaOM Custom Post Type Factory version a1 as active, updated 14y ago and tested up to WordPress 3.4.

Overview

About this plugin

This is a convenience class and collection of methods to make creating new custom post types with their own metaboxes easy.

The general idea is to define a function that’s hooked to the register_post_types action. The function defines a class for your post type that extends the GO_Cpt class. org/Widgets_API#Developing_Widgets.

The result is a new custom post type and much easier creation and updating of custom meta associated with that post type. You’ll also have a convenient object you can use to access the metadata associated with each post.

function my_customposttype() { class My_CustomPostType extends GO_Cpt { function __construct() { // execute the parent constructor with the name // and definition for the custom post type parent::__construct( $post_type_name, $post_type_definition ); } function metabox( $post, $meta ) { // print out the form here // // this method is optional, only use it if you want to // add a metabox to your custom post type } function update( $new_meta, $old_meta ) { // sanitize and validate the metadata // then return $meta so it can be saved // // this method is required if a // metabox() method is included } } global $my_customposttype; $my_customposttype = new My_CustomPostType; } // hook that function to the register_post_types action add_action( 'register_post_types', 'my_customposttype' );

Backstory: defining the post type class inside the function avoids issues with loading order and fatal errors resulting from attempting to extend a class that might not exist yet. Isn’t PHP awesome?

php

To access the meta associated with a post, you can call $my_customposttype->get_meta( $post_id );

You can easily add a method and hook to filter the_content or the_excerpt to insert custom values that may have been entered in the post meta. Simply add add_filter( 'the_content', array( $this, 'the_content' )); in the __construct() and then define another method in the My_CustomPostType class such as:`

function the_content( $content ) { $meta_print = print_r( $this->get_meta( get_the_ID() ), TRUE ); return $meta_print. $content }

`

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • custom post types
  • custom posts
  • post types
  • developers
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 3.4

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 3.4.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to3.4
Minimum requirementsWordPress 3.3 · PHP not listed
Update activity13 Aug 201214y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.