Plugin Directory

Test out the new Plugin Directory and let us know what you think.
!This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.


Portico makes defining and administering custom post-types EASY. Define your post-type in a class, and an admin interface will be created for you.


There are just two steps to implementing a custom post-type with Portico. Here's a quick overview before we get down to the coding required.

  • Declare a class that defines your custom post type.
  • Create a display template for the new post type.

That's it! Portico handles the rest for you, and that includes building an admin interface for working with posts of the new type.


Let's take a look at a simple example, the implementation of a Podcast post-type.

Here's what the custom post-type's definition looks like:


 * Podcast custom post-type implemented using the Portico plugin
class Podcast extends \portico\CustomPostType
    protected function setUp()
        //At present, "mandatory" simply marks the field as mandatory in the admin interface
        $this->addCustomField('artist', 'Artist', array(
            'mandatory' => true,

        //Default values can also be applied to text fields
        $this->addCustomField('genre', 'Genre', array(
            'values' => array(
                'Ambient' => 'Ambient',
                "Drum 'n' Bass" => "Drum 'n' Bass",
                'Dubstep' => 'Dubstep',
            'default' => "Drum 'n' Bass",

        //Set "length" to NULL to get a textarea
        $this->addCustomField('trackList', 'Track List', array(
            'length' => null,

Put the code in functions.php - or in a separate file included by functions.php - in your theme.

The next time you visit the WordPress admin area you should see a "Podcasts" section in the left-hand menu, beneath the usual "Posts" and "Pages" links. Take a look at the first screenshot to see exactly what you can expect.

All that remains is to create a custom display-template so we can view the values of a podcast's custom fields.

You can start by making a copy of single.php and renaming it after your custom post-type. Here's the template for the Podcast type, based on single.php shipped with the Modern Clix 1 theme:

<?php get_header() ?>

<div id="content" class="col span-8">

<?php if (have_posts()) : ?>

    <div class="col last span-6 nudge-2">
        <h4 class="ver small">You are reading</h4>    
    <?php while (have_posts()) : the_post() ?>
        <?php $podcast = new Podcast($post, get_post_custom(get_the_ID())) ?>

    <div class="post">
        <div class="post-meta col span-2">
            <ul class="nav">
                <li>Artist: <?php echo $podcast->getSingleCustomFieldValue('artist') ?></li>
                <li>Genre: <?php echo $podcast->getSingleCustomFieldValue('genre') ?></li>
        <div class="post-content span-8 nudge-2">
            <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute() ?>"><?php the_title() ?></a></h3>

            <?php the_content('Continue reading...') ?>

            <p><?php echo nl2br($podcast->getSingleCustomFieldValue('trackList')) ?></p>
    <?php comments_template() ?>

    <?php endwhile ?>

<?php else : ?>

    <h3>Post Not Found</h3>

    <p>Sorry, but you are looking for something that isn't here.</p>

<?php endif ?>

<hr />

<?php get_sidebar() ?>
<?php get_footer() ?>

Important to note here is the line that creates an instance of your custom post type, <?php $podcast = new Podcast($post, get_post_custom(get_the_ID())) ?>. It's from this instance that we get the values of the custom fields.

Take a look at the second screenshot to see what you can expect from this template.

Requires: 3.0 or higher
Compatible up to: 3.5.2
Last Updated: 4 years ago
Active Installs: Less than 10


0 out of 5 stars


Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.