Plugin: Custom Post Type UI

I recently discovered a plugin called “Custom Post Type UI.” It allows you to very easily add a WordPress Custom Post Type to your web site, without having to write any code.

Why would you want to use this?

If you need to add a very simple Custom Post Type, such as for press releases or testimonials, this can let you do this in less than five minutes. You can set up the labels, slugs, even control what meta boxes get displayed when you are creating and editing post content. So for very simple CPTs, this is a nice and quick solution.

This is also a solution if you’re not familiar with writing code. So for the non-technical types, this is probably your best bet.

Why would you not want to use this?

While the plugin does give you a lot of options and customizations, it’s not a solution for optimal control or performance. Because the plugin is very generalized (and it needs to be if it’s going to create any CPT you need) it has some limitations. Speed would be one of these. The plugin uses a lot of code to implement its features, whereas custom written code would be more optimized, but would be very specific to its purpose. So there are trade-offs.

Practical Use

The plugin does provide all the capability you need in order to create your CPTs and display them. You can declare the URI segments and slugs you want to use to display your new content. Since WordPress will use your index.php and single.php theme template files for the basic display of your new content, you will be able to see your new content without having to make any major chances.

If you need more custom display of your new content, you’ll have to do a little more work. For example, if you create a CPT for portfolio images, you may want to display some of these on your home page. This doesn’t happen automatically. You could add the following code to your home.php template file:

$args = array(
  'post_type' => 'portfolio',
  'echo' => 0,
  'title_li' => '<h2>Portfolio Pages</h2>',
  'depth' => 1,
  'show_date' => '',
  'number' => 5,
);
$pages = wp_list_pages( $args );
if ($pages) {
  echo '<ul>';
  echo $pages;
  echo '</ul>';
}

This will output an unordered list <ul> of your CPT pages. Of course, you can be a lot more creative with the display, showing images and such but this gives you an idea of how to go about it.

You can read the WordPress Codex for more information on the wp_list_pages() function.

Leave a Comment

Your email address will not be published.