Conclusion – WordPress Custom Post Types vs. Pods CMS Framework

Wordpress custom post types vs. Pods CMSLets bring it on home. For the conclusion of WordPress Custom Post Types vs. Pods CMS Framework, I’ll do a sum-up.

I’ve been working with Pods for a while now. It’s an excellent system, but falls short of the features an editor would want, but is much more simple for the developer.

Initial setup of complex datasets

Winner: Pods CMS Framework

Pods allows quick and easy setup of large forms and relational databases. It excels in making it very simple for a developer to create many, many cross-related items in a short amount of time. If you’re looking to set up something complex quickly, this is the way to go.

Administration Menus

Winner: Pods CMS Framework

C’mon, it’s a checkbox. Check it, you’ve got a menu item.

Manage Screens

Winner: Pods CMS Framework

You’re already building your admin menus using the Pods UI code, and building the manage screens happens in the same place. Adding in Pods Display Helpers will allow you to do fancy things on those manage screens.

I know that you can control the WordPress manage screens with plugins, but I won’t be looking into that for now.

Forms and Features

Winner: WordPress Custom Post Types

You just can’t beat native WordPress functions like drafts, previews, revisions and scheduling (among many others.) Once you add in custom taxonomies you’re opening your content up to a world of possibilities. Also, throw in Posts 2 Posts and you’ve got your content types relating. Even though Pods does relationship setups better, once they’re set up WordPress excels in working on two (or more) content types at once.

Viewing your content

Winner: WordPress Custom Post Types

I’ve gotta give it to WordPress here. If you’re already programing in WordPress, then you’re already familiar with the massive amounts of functions that are available to you. And if you need to have variables to manipulate you can turn the content into variables by using something like get_the_title() instead of the_title().

Final Conclusion (for now)

Winner: WordPress Custom Post Types

Primarily due to the features added in forms, but also because the content of my items will show up in search. Plus using CPT’s will allow me to keep all my html code consistent.

I’ve got a big project coming up and I’ve recommended that we go with CPT. Our clients need those posting features and I need them to be able to add taxonomy items on the fly.

Notes:

I built these pages out because Pods has served me well for a long time. I’m open to any suggestions, comments, changes etc. Even though I’m using CPT’s on my next project, the jury is still out for what I’ll use long-term.

Also, there are some major upgrades coming in Pods 2.0 which will include UI changes and the ability to make WordPress Custom Post Types as well as custom taxonomies (along with Pod items.)

  1. WordPress Custom Post Types vs. Pods CMS Framework – part 1
  2. Part 2: Admin Menus – WordPress Custom Post Types vs. Pods CMS Framework
  3. Part 3: Forms and Features – WordPress Custom Post Types vs. Pods CMS Framework
  4. Part 4: Viewing Items – WordPress Custom Post Types vs. Pods CMS Framework
  5. Conclusion – WordPress Custom Post Types vs. Pods CMS Framework

Part 4: Viewing Items – WordPress Custom Post Types vs. Pods CMS Framework

Wordpress custom post types vs. Pods CMSFor Part 4 of WordPress Custom Post Types vs. Pods CMS Framework, I’ll break apart what it takes to print your items out on the front end of your site. First up, Pods:

Pods CMS Framework – presenting items

URL structure

Setting up your URL structure with Pods is very easy. There is a tab built into the Pods settings page:

screenshot: Pods setup - page/url structure tab

With the pages tab you can add any url’s you’d like. Simply type in the url you’d want, for instance “movies”, then it allows you to choose a template to show when a user goes to that url. So, if you go to triphere.com/movies, the site will pull up the template I’ve chosen – in this case a template named “Movies”.

screenshot - pods page setup, movies page

You can setup any level of structure as well. Because I want to have my movies reside under the “movies” url, I set up a new page with url “movies/*”, and call the same template. Thus, the url triphere.com/movies/fight-club will now go to the Fight Club page.

Creating a list of items

Pods uses their own code to call the database and get info on an item. Again, I don’t want to go too much into how to do all this. Here’s a great link on how to present items:

Here is a general way to make our list of movies:

$pod_name = 'movies';
$pods = new Pod($pod_name);
$pods->findRecords('name ASC', -1);
$total_pods = $pods->getTotalRows();
$item=0;
$first_slug=0;
if( $total_pods>0 ) {
	?>
	<h1>Movies</h1>
	<?
	while ( $pods->fetchRecord() ) {
		foreach($pods->data as $key=>$value){
			$$key = $value;
		}
		$image = $pods->get_field('image');
		if($image){
			$photo = wp_get_attachment_image_src($image[0]['ID'],'thumb');
		}
		$actors = $pods->get_field('actors');
		$genre = $pods->get_field('genre');

In this example, we’re ordering the movies by ‘name ASC’ (line 3)

One thing about Pods is that if you’re making template files that go into your theme folder, you can’t use their excellent Magic Tags feature, thus you have to declare all your variables using the get_field function:

$actors = $pods->get_field('actors');

This can become cumbersome when you have a bunch of variables and you’re also using this content in multiple templates because you have to keep re-declaring them. I use the foreach (line 12) that is in the code above so that I don’t have to write them all out. However, this does not automatically include PICK or media, thus I have to create the get_field lines to get those related variables. (lines 19-20)

WordPress CPT – presenting items

URL Structure

This has been a bit tricky for me. I know how to set up the actual basic url, it happens when you set up the original CPT with register_post_type(). It uses the rewrite option.

register_post_type('cpt_movies', array(
	...
	'rewrite' => array('slug' => 'cpt_movies'),
	...
));

Creating a list of items

This will use the native functions you’d have with WordPress. See the codex for information about the_post().

As far as variables go, you can build out your pages just like any WordPress post with things like the_title() or the_content().

For ordering of items, you’ll use WP_QUERY(). Pretty much the same stuff you’d do with any WordPress page/post setup.

Winner?

Depends on what you know. If you’re coming to WordPress fresh with a PHP background, Pods will seem more familiar to you. If you want to stick with the “WordPress Way”, the Custom Post Types are definitely the way to go.

  1. WordPress Custom Post Types vs. Pods CMS Framework – part 1
  2. Part 2: Admin Menus – WordPress Custom Post Types vs. Pods CMS Framework
  3. Part 3: Forms and Features – WordPress Custom Post Types vs. Pods CMS Framework
  4. Part 4: Viewing Items – WordPress Custom Post Types vs. Pods CMS Framework
  5. Conclusion – WordPress Custom Post Types vs. Pods CMS Framework

Part 3: Forms and Features – WordPress Custom Post Types vs. Pods CMS Framework

Wordpress custom post types vs. Pods CMS
For Part 3 of WordPress Custom Post Types vs. Pods CMS Framework, I wanna look at the forms that are created natively when putting together new items and the default features that are a part of those forms. I’ll start with Pods this time:

Pods CMS Framework forms for the Movies CMS

The pods form is fairly basic, but the HTML is very easy to style. Here’s an example of one form element’s code:

<div class="leftside name">
	<label for="pods_form1_name">Movie Name <span class="red">*</span></label>
</div>
<div class="rightside name">
	<input type="text" maxlength="128" value="" id="pods_form1_name" class="form txt name pods_field pods_field_name pods_coltype_txt" name="name">
</div>

Each element that Pods adds follows this structure. If you have to do custom styling, it’s fairly easy. Here’s a look at the form from pods:

screenshot pods movie cms actor form

screenshot: Pods movie CMS actor form

Details on the pod form:

How do we select a movie?

screenshot: Pods movie CMS actor form - select movie

screenshot: Pods movie CMS actor form - select movie

The native multiple-relationship-picker shows a list of the relational-items and you click on them to choose the connected items.

How do we select or upload an image?

screenshot: Pods movie CMS actor form - add an image

When uploading a new image through the Pods form, clicking “Select + Upload” brings up the typical file-finder on Mac or PC. If you click “Browse Server” it gives the window you see in the screenshot above. This is what the image section looks like after you’ve selected an image:

screenshot: Pods movie CMS actor form - image selected

A note on the forms:

Pods has a fantastic “helper” system which allows infinite possibilities when it comes to making the individual form elements do what you want. You can add any code (php, js, html, css, etc) into these helpers, which can then replace the native form-element code. Very handy.

WordPress Custom Post Types Movie CMS forms

The WordPress form we’ve set up automatically has all of the WordPress posting features. Right off the bat we have drafts, publishing schedule, who can view, and preview.

The HTML is much more complicated for WordPress forms, but it is consistent across all their forms. Much harder to style, but would style it for all the WP forms.

screenshot: WordPress movie CMS actor form

Details on the WordPress form

How do we select a movie?

To re-iterate, we’re using the Posts 2 Posts plugin to create the connections between multiple CPT’s. This interface is native to the P2P plugin:

  1. Interface before changes, search box is showing:

    screenshot: WordPress movie CMS actor form: select movie

  2. Interface after searching for “Thelma”:

    screenshot: WordPress movie CMS actor form: searched for movie

  3. Interface showing Recent movies:

    screenshot: WordPress movie CMS actor form: recent movies

  4. Interface after adding a “New Movie”:

    screenshot: WordPress movie CMS actor form: add a new movie

The one issue I have so far with P2P is that when adding to a connected CPT it adds that new item as a draft. You can see it says “draft” next to Kalifornia in the example above. The only way to fix this is to go into the actual item and click “Publish”.

How to we select/upload an image?

This uses the native WordPress media library interface. Lots of options, edit details on multiple images at once, etc.

Winner?

Easy winner by far is WordPress Custom Post Types. The ability to have drafts/publish/schedules combined with the native WP medial library is a knockout. Add to that Posts 2 Posts great ability to search for and add items from another CPT and the work for an editor is cut by a third.

  1. WordPress Custom Post Types vs. Pods CMS Framework – part 1
  2. Part 2: Admin Menus – WordPress Custom Post Types vs. Pods CMS Framework
  3. Part 3: Forms and Features – WordPress Custom Post Types vs. Pods CMS Framework
  4. Part 4: Viewing Items – WordPress Custom Post Types vs. Pods CMS Framework
  5. Conclusion – WordPress Custom Post Types vs. Pods CMS Framework

Part 2: Admin Menus – WordPress Custom Post Types vs. Pods CMS Framework

Wordpress custom post types vs. Pods CMS

admin menu view for wordpress

In this section we’ll look at the difference in setting up the Admin menus for your items. For both CPT and Pods we have to write code to add in the custom menus. In the image on the left, the Movies menu and its sub-items are for Pods and the CPT… menu items are built with WordPress CPT.

Building an Admin menu with WordPress Custom Post Types

CPT’s admin menus

CPT admin menus are part of the register_post_type function. The full code for these is in Part 1, so here is the relevant code:

For CPT Movies:

/*
Register the custom post type "CPT Movies"
*/
register_post_type('cpt_movies', array(
	...
	'show_in_menu' => true,
	...
));

For CPT Actors (puts it in the main CPT Movies tab):

/*
Register the custom post type "CPT Movies"
*/
register_post_type('cpt_movies', array(
	...
	'show_in_menu' => 'edit.php?post_type=cpt_movies',
	...
));

Pods CMS Framework Admin Menus

If you want your Pod item to show up in the main admin menu, it’s simple – just check the “Top Level Menu?” box. Blam! You’re in the main menu.

You can also create more full-featured menus with great control over the manage pages themselves. The code we create not only adds the admin menus, but dictates how the manage and edit screens will look. I always put my Pods Admin Menus code into a single plugin.

In order to have main admin menus, you need a few pieces of code. Again, Monday By Noon has a better explanation, but in short – here is the full plugin code I use to make the menus for this Movies CMS:

<?php
/*
Plugin Name: Pods Menus
Plugin URI: http://triphere.com/
Description: Customized Pods Admin Menus
Version: 1.0
Author: Scott Nath
*/

function pods_admin_menus(){
  $icon = '';
  add_object_page('Movies', 'Movies', 'read', 'movies', '', $icon);
  add_submenu_page('movies', 'Manage Movies ', 'Manage Movies ', 'read', 'movies', 'movies_page');
  add_submenu_page('movies', 'Add Movie', 'Add Movie', 'read', 'movies&action=add', 'generic_add_page');
  add_submenu_page('movies', 'Manage Actors ', 'Manage Actors ', 'read', 'actors', 'actors_page');
  add_submenu_page('movies', 'Add Actor', 'Add Actor', 'read', 'actors&action=add', 'generic_add_page');
  add_submenu_page('movies', 'Manage Genres', 'Manage Genres ', 'read', 'genres', 'genres_page');
  add_submenu_page('movies', 'Add Genre', 'Add Genre', 'read', 'genres&action=add', 'generic_add_page');
}

function movies_page(){
  $object = new Pod('movies');

	$object->ui = array(
        'title'   => 'Movies',
        'item' => 'Movie',
        'sort' => 'slug ASC',
        'columns' => array(
			'name'      => 'Movie',
			'actors.name'      => 'actor',
			'genre.name'      => 'Genres',
			'excerpt'      => 'Excerpt',
			'modified'  => 'Last Modified'
			)
		);
  pods_ui_manage($object);
}
function actors_page(){
  $object = new Pod('actors');

	$object->ui = array(
        'title'   => 'Actors',
        'item' => 'Actor',
        'sort' => 'slug ASC',
        'columns' => array(
			'name'      => 'Actor',
			'movie.name'      => 'movies',
			'excerpt'      => 'Excerpt',
			'modified'  => 'Last Modified'
			)
		);
  pods_ui_manage($object);
}
function genres_page(){
  $object = new Pod('genres');

	$object->ui = array(
        'title'   => 'Genres',
        'item' => 'Genre',
        'sort' => 'slug ASC',
        'columns' => array(
			'name'      => 'Genre',
			'excerpt'      => 'Excerpt',
			'modified'  => 'Last Modified'
			)
		);
  pods_ui_manage($object);
}
function generic_add_page(){
}

add_action('admin_menu','pods_admin_menus');

?>

No simple winner here. It’s nice that it’s all in the register_post_type native function. For Pods, using their UI functions has a hard learning curve, but it allows tons of possibilities on the manage screens.

  1. WordPress Custom Post Types vs. Pods CMS Framework – part 1
  2. Part 2: Admin Menus – WordPress Custom Post Types vs. Pods CMS Framework
  3. Part 3: Forms and Features – WordPress Custom Post Types vs. Pods CMS Framework
  4. Part 4: Viewing Items – WordPress Custom Post Types vs. Pods CMS Framework
  5. Conclusion – WordPress Custom Post Types vs. Pods CMS Framework

WordPress Custom Post Types vs. Pods CMS Framework – part 1

Wordpress custom post types vs. Pods CMS
I’ve built quite a few sites with the Pods CMS Framework to great, great success. However, after attending Wordcamp San Francisco this last August I’ve decided to take a hard look at WordPress’ native Custom Post Types (CPT). I had more than one mid-day (and late night) conversation about the pros and cons of CPT’s and how they compare to the Pods system.

With that in mind, I’ve decided to try a compare-and-contrast of the two systems.

note: the word item will refer to either Pods “pod item” or WordPress “custom post type”

The test case – basic movie CMS

I created a three-part CMS:

  1. Movies
    • image
    • genre (see Genre below)
    • actors (relates to Actors item)
    • Like movie? (checkbox)
    • excerpt
    • main description
  2. Actors
    • image
    • movies (relates to Movies item)
    • excerpt
    • main desc
  3. Genre
    • Pods: pod item
    • CPT: custom tag taxonomy

Final pages:

Building the CMS

WordPress CPT

There are many plugins for building Custom Post Types in WordPress, but I chose to write the code out – mostly to help me learn about it. I tried out the plugin Custom Post Type UI and that one worked excellent. My favorite part was that it would allow you to grab the WordPress code (such as register_post_type) it was building for you. Sped up the learning process a lot.

The real conundrum with W-CPT’s is that there is no “WordPress way” to relate the items. You have to use a plugin. I chose the Posts 2 Posts WordPress plugin. It requires coding to create the connections, but it’s not too complicated.

The code for the Movies CPT:

/*
Register the custom post type "CPT Movies"
*/
register_post_type('cpt_movies', array(
	'label' => 'CPT Movies',
	'description' => 'Custom post type version of movies',
	'public' => true,
	'show_ui' => true,
	'show_in_menu' => true,
	'capability_type' => 'post',
	'hierarchical' => false,
	'rewrite' => array('slug' => 'cpt_movies'),
	'query_var' => true,
	'has_archive' => true,
	'supports' => array(
		'title',
		'excerpt',
		'editor',
		'revisions',
		'thumbnail'
	),
	'labels' => array (
		'name' => 'CPT Movies',
		'singular_name' => 'CPT Movie',
		'menu_name' => 'CPT Movies',
		'add_new' => 'Add Movie',
		'add_new_item' => 'Add New Movie',
		'edit' => 'Edit',
		'edit_item' => 'Edit Movie',
		'new_item' => 'New Movie',
		'view' => 'View Movie',
		'view_item' => 'View Movie',
		'search_items' => 'Search CPT Movies',
		'not_found' => 'No CPT Movies Found',
		'not_found_in_trash' => 'No CPT Movies Found in Trash',
		'parent' => 'Parent Movie',
	),
));

The code for the Actors CPT:

/*
Register the custom post type "CPT Actors"
*/
register_post_type('cpt_actors', array(
	'label' => 'CPT Actors',
	'description' => '',
	'public' => true,
	'show_ui' => true,
	'show_in_menu' => true,
	'capability_type' => 'post',
	'hierarchical' => false,
	'rewrite' => array('slug' => 'cpt_actors'),
	'query_var' => true,
	'has_archive' => true,
	'supports' => array(
		'title',
		'revisions',
		'thumbnail'
	),
	'labels' => array (
		'name' => 'CPT Actors',
		'singular_name' => 'Actor',
		'menu_name' => 'CPT Actors',
		'add_new' => 'Add Actor',
		'add_new_item' => 'Add New Actor',
		'edit' => 'Edit',
		'edit_item' => 'Edit Actor',
		'new_item' => 'New Actor',
		'view' => 'View Actor',
		'view_item' => 'View Actor',
		'search_items' => 'Search CPT Actors',
		'not_found' => 'No CPT Actors Found',
		'not_found_in_trash' => 'No CPT Actors Found in Trash',
		'parent' => 'Parent Actor',
	),
));

The code for the Genres Taxonomy:

/*
Register the custom post type taxonomy "CPT Movies Genre"
*/
register_taxonomy('movies_genre',array(
	0 => 'cpt_movies',
	),
	array(
		'hierarchical' => false,//change to true to make this a category
		'label' => 'CPT Movies Genre',
		'show_ui' => true,
		'query_var' => true,
		'rewrite' => array('slug' => ''),
		'singular_label' => 'CPT Movie Genre'
	)
);

The code for the Genres Taxonomy:

/*
Use the plugin Posts 2 Posts

http://wordpress.org/extend/plugins/posts-to-posts/

documentation:

https://github.com/scribu/wp-posts-to-posts/wiki

this creates a connection between CPT Movies and CPT Actors
*/
function my_connection_types() {
    if ( !function_exists( 'p2p_register_connection_type' ) )
        return;

    p2p_register_connection_type( array(
        'from' => 'cpt_movies',
        'to' => 'cpt_actors',
        'reciprocal' => true
    ) );
}

add_action( 'init', 'my_connection_types', 100 );

Pods CMS Framework

Pods is a different beast altogether. Items are made via a form-based system (note: this UI will be changing in Pods 2.0). They are very easy to implement. Relationships are super-simple as well. I’d rather not re-write the wheel here, so here’s a a couple links on how to set up a pod:

The view of the Movies Pod:

pods cms movies pod item

screenshot: Pods CMS movies pod item

The view of the Actors Pod:

screenshot: Pods CMS actors pod item

The view of the Genre Pod:

screenshot: Pods CMS genre pod item

The easy winner in the initial implementation is the Pods CMS. Especially when looking at setting up the relationships.

  1. WordPress Custom Post Types vs. Pods CMS Framework – part 1
  2. Part 2: Admin Menus – WordPress Custom Post Types vs. Pods CMS Framework
  3. Part 3: Forms and Features – WordPress Custom Post Types vs. Pods CMS Framework
  4. Part 4: Viewing Items – WordPress Custom Post Types vs. Pods CMS Framework
  5. Conclusion – WordPress Custom Post Types vs. Pods CMS Framework