CustomPress: Create Incredible Custom Content for WordPress with Ease

One of the things that makes WordPress powerful is the ability to create custom content like custom post types, custom taxonomies, and custom fields.

All of these can be created using code, as I detailed in my guides to coding custom post types and custom taxonomies and fields.

But what if you’re not comfortable delving into the code or creating plugins or themes? The good news is that you can create custom content types in your site using our CustomPress plugin, which lets you do it all via the admin screens.

With CustomPress you can create custom post types for any kinds of products and services, even vinyls for an online record shop.
With CustomPress you can create custom post types for any kinds of products and services, even vinyls for an online record shop.

In this post, I’ll create a dummy site using all three custom content types: custom post types, custom taxonomies, and custom fields. I’ll walk through the process of creating all three and viewing them on your site using the CustomPress plugin. The site I’m going to create is a book listings site: you can either follow along and create a similar site or use these techniques on your own site.

I’ll be using the twenty fifteen theme for my site, but you could use any theme with the plugin. Later in the post I’ll use a more advanced technique for displaying custom fields which involves creating a child theme of twenty fifteen and making some simple edits to one of the sites. If you’re not comfortable doing this, rest assured: you can display custom fields without writing code, it just takes a little bit more work each time you create a new post where you want to display those custom fields.

Introduction to CustomPress

Before we start creating our site, let’s take a quick look at the CustomPress plugin.

CustomPress is the only plugin that lets you create all three custom content types in WordPress. There are some great alternative plugins that help you create one or more custom content types without writing code, but if you want to use all three, then this one will do the job.

Create custom post types, taxonomies and custom fields with ease with CustomPress.
Create custom post types, taxonomies and custom fields with ease with CustomPress.

Once you’ve installed CustomPress it gives you an interface that you access via the admin screens, which lets you create as many custom posts, taxonomies and fields as you need for your site. It then gives you shortcodes you can use to display your custom fields in your posts, and lets you add the archives for your custom posts and taxonomies to your navigation menu. I’ll cover all of this in detail in this post.

So let’s get started using the plugin!

Our Project

The project I’ll be working on here is a book site, with information about a number of books.

For this site, I need the following custom content types:

  • Custom post type: book
  • Custom taxonomies: author, genre, publisher
  • Custom fields: ISBN, date published

Here’s a screenshot of the main archive page for books on the site:

Books listing page with widgets and menu

To follow along with this tutorial, you’ll need an empty WordPress installation (or your own site you want to add custom content to) and the CustomPress plugin downloaded, installed and activated.

I’ll show you how to add each of the custom content types listed above as we work through this post. Let’s start with a custom post type.

Creating a Custom Post Type

To be able to list books on our site, we need a custom post type called ‘book’.

In the WordPress admin, go to the CustomPress link in the admin menu which is created when you install and activate the plugin. You’ll see a screen listing all the post types in your site so far, which is none.

Click on the Add Post Type button to display the Add Post Type screen:

CustomPress - top portion of screen for adding a post type

The screenshot above shows the top part of my completed screen. Complete the metaboxes as follows:

  • Post Types: type “book.”
  • Supports: select Title, Editor, Thumbnail, Excerpt, Custom Fields, and Revisions.
  • Supports regular taxonomies: uncheck Categories and Tags.
  • Public: select TRUE.

Now scroll down to continue editing the post type. Here’s the next section of the screen:

CustomPress adding a post type - second section of screen

Edit the settings as follows:

  • Capability type: keep this as “post.”
  • Map Meta Capabilities: make sure TRUE is checked.
  • Role Capabilities Settings: don’t change anything here.
  • Show UI: make sure TRUE is selected.
  • Show in Nav Menus: make sure TRUE is selected.
  • Publicly queryable: Make sure TRUE is selected.
  • Exclude from Search: make sure FALSE is selected.

Now scroll down to complete more settings:

CustomPress add post type screen - third part of screen

Edit the settings as follows:

  • Labels: complete the labels fields using “Book” or “Books” as appropriate (e.g. “Add New Books,” “Search Books”). Leave the Parent Item Colon and Custom Fields Block fields empty.
  • Hierarchical: check FALSE. This makes the post type behave like a tag rather than a category, so you can’t have parent posts.
  • Has Archive: make sure TRUE is checked. Type “books” in the Custom Slug field.
  • Rewrite: make sure TRUE is checked.

Now scroll down to complete the bottom part of the page:

CustomPress add post page - fourth and final part of page

Complete the remaining fields as follows:

  • Description: leave this blank unless you want to have a description at the top of each archive page for your books.
  • Menu Positon: type “20.”
  • Menu Icon: leave this blank.
  • EP Mask: leave the first option checked.
  • Query var: makes sure TRUE is checked.
  • Can export: make sure TRUE is checked.

Finally, scroll down to the very bottom of the page and click the Add Post Type button. Your new post type will be saved and a menu item will appear for it in the admin menu.

Creating Custom Taxonomies

Now let’s move on to creating some custom taxonomies for the books in the site. First off, a taxonomy for the author.

Note: the record in the author taxonomy will be different from the author of an individual post on your site. The author of the post is you: the author of the book probably won’t be!

Click on the CustomPress link in the admin menu and then on the Taxonomies tab. Click the Add Taxonomy button.

Adding a custom taxonomy - part 1 of screen

Start by completing the fields at the top of the screen, as shown in the screengrab above:

  • Taxonomy: type “author.”
  • Post Type: select book.
  • Public: select TRUE.
  • Show UI: select TRUE.

Now scroll down to the next part of the screen:

CustomPress add taxonomy screen - section section of screen

Complete the fields as follows:

  • Labels: complete each field using “Author” or “Authors” as appropriate, for example “Add New Author,” “Search Authors” As this taxonomy isn’t hierarchical, leave the Parent Item and Parent Item Colon fields blank.
  • Show Tagcloud: check TRUE.
  • Show in Nav Menus: check TRUE.
  • Hierarchical: check FALSE.

Now scroll down again to complete some more fields:

CustomPress add taxonomy screen - third part of screen

Complete the settings as follows:

  • Rewrite: check TRUE and Allow Front Base.
  • EP Mask: select the first option.

Now scroll down to complete the final fields:

Adding a cusotm taxonomy - bottom of screen

Select the following options:

  • Show Admin Column: TRUE
  • Query var: TRUE.

Finally, click the Add Taxonomy Type button to create the custom taxonomy.

Repeat this for two more taxonomies: genre and publisher. Both of these should be hierarchical, which means you complete all of the fields in much the same way as before but selecting TRUE for Hierarchical and adding a value in the fields relating to parent posts.

Once you’ve done this, you’ll see your three taxonomies listed in the main Taxonomies screen:

Taxonomies listing screen with taxonomies added

So we now have a post type with three taxonomies we can use for it. Let’s move on to create some custom fields.

Creating Custom Fields

For each book, we want to have two custom fields: one for the ISBN and one for the publication date.

To add a new custom field, click on CustomPress in the admin menu and then on the Custom Fields tab. Click the Add Custom Field button to see the screen for adding your custom field:

Adding a Custom Filed - part 1

Starting with the ISBN field, complete the fields in the top part of the screen as follows:

  • Field Title: type “ISBN.” Leave the rest of the fields in this metabox blank.
  • Post Type: select book.
  • Hide input for this Post Type: select all of the post types except book.

Scroll down to complete the remaining fields:

Adding a custom field - part 2

Complete the remaining options as follows:

  • Field Type: select Text box. Type the following in the Regular Expression Validation field: ISBN(?:-13)?:?\x20*(?=.{17}$)97(?:8|9)([ -. Don’t worry too much about how this works, it just ensures that your users type the ISBN in consistently.
  • Field Description: type “13 digit ISBN number for the book, with ISBN at the beginning and hyphens (example: ISBN 978-1-123-12345-1).”

Now click the Add Custom Field button at the bottom for the screen.

Repeat this for the publication date custom field. This time you need to select Date Picker for the Field Type, and you don’t need to type in a regular expression validator.

Here are the two custom fields added to the site:

Custom Fileds listing screen with 2 custom fields added

Now that we have all of our custom post types, taxonomies and fields in place, we can start adding some books.

Adding Books to the Site

Adding books to the site is very similar to adding a normal post. Simply click on Books > Add New in the admin menu to access the editing screen:

Ading a new book - top half of screen

Type the description of the book into the main content pane and type in the name of the author in the Authors taxonomy metabox. Once you’ve got some authors added to the site you’ll be able to select them in the same way as you would tags.

Scroll down to finish adding content to the book:

Adding a new book - bottom half of screen

Complete the custom fields with the value for the book and add an excerpt if you want to. here I’ve added a quote from the book. Type in or select one or more genres and a publisher: these work in the same way as categories so you’ll be able to select them as you add more books, genres and publishers.

Finally click on the Add featured image link and upload the featured image for your book. Then click the Publish button to publish the book.

Repeat this until you have a few books added to the site. Mine are shown in the screenshot:

Books listing screen in the WordPress admin

Now you need visitors to your site to be able to see your books. To do that we need to create a navigation menu.

Creating a Navigation Menu

If your site already has a navigation menu set up, you’ll need to add a custom link to that but if you don’t have one yet you’ll need to create one first:

  • Go to Appearance > Menus.
  • Click the link for creating a menu.
  • Type the name of your menu in the Menu Name field. This won’t be seen by visitors but is for your reference.
  • Click the Create Menu button.
  • Now add items to your menu by dragging them across from the list on the left.

The first item I’m going to add is a custom link to the books archive. Click on the Custom Links option on the left and type in “http://mysite.com/books,” where “mysite.com” is the domain name for your site. In the Link Text field, type “Books.”

Now click the Add to Menu button to add this link to your navigation menu. It will look like this in the menu listing on the right:

Adding a custom link to the navigation menu

Add any additional pages in your site that you want to include in the menu: I’ve added my home page, as you can see in the screen shot:

Final navigation menu in the admin screen

Now check the Primary Menu option to make sure your menu shows up on the site, and click the Save Menu button.

Adding Widgets

Instead of adding the custom taxonomies to the navigation menu, we’re going to make them constantly visible to users by creating widgets for them.

To do this you’ll need to download another plugin, which is available free on the WordPress plugin repository:  Custom Taxonomies Menu Widget. Install and activate the plugin as you normally would.

Now go to the Widgets editing screen by clicking on Appearance > Widgets.

Drag the Custom Taxonomies Menu Widget into your sidebar and complete its fields as shown in the screenshot:

Taxonomies widget settings

The first widget I’ve added is for the author taxonomy. To have the widget display this taxonomy, make sure you’ve checked the top level Authors box and unchecked the top level boxes for the other taxonomies. Don’t worry about the individual taxonomy terms, they’ll be dealt with automatically by the plugin.

In the Display Options box, type in “Authors” for the menu title, select Name and Ascending for ordering and check the show post count box. Check the Auto option in the box for how new terms are handled.

Click the Save button to save your widget. Now repeat this for the other two taxonomies, dragging the widget into the sidebar widget area two more times and completing the fields for each one as appropriate. This means you’ll have three widgets in your widget area.

Note: You may find that WordPress has automatically added some other widgets to your sidebar widget area. Delete any you don’t want by dragging them away from the widget area in the Widgets screen or clicking the Delete link in each.

Here’s how the site looks now with our menu and widgets added:

Books listing page with widgets and menu

The post types and taxonomies can be viewed by visitors now which is great: but we need to add custom fields.

Adding Custom Fields to Single Book Pages

By default, any custom fields you create won’t be displayed on the site. To make them visible, you need to add them to the place on the page where you want them to be shown.

There are two ways to do this:

  • By typing a shortcode into your posts at the point where you want the custom fields to be displayed. This is very simple but you need to do it every time you add a book to your site.
  • By adding some code to the template file in your theme that displays your books. This is more complicated because it requires adding some code, but you only need to do it once and it will apply to every new book you add to your site.

First I’ll show you how to do it with a shortcode.

Adding Custom Fields with a Shortcode

To add custom fields to a book, you use a shortcode that’s provided with the plugin. Open the book you want to edit and type the shortcode after the main text in the content pane. The shortcode is [custom_fields_block]. You can see I’ve added it to one of my books in the screenshot:

Book editing screen with shortcode added

Then save your changes by clicking the Update button and view your book:

book-single-frontend-with-cf-shortcode

The custom fields are all displayed below the main text for the book. To do this for all of your books, edit each book and add the same shortcode to each.

Adding Custom Fields with Code

The shortcode method above is really easy but you do have to repeat it every time you add a new book. If you can display your custom fields using code instead, you won’t have to do this.

The first step is to identify the template file in your theme that is used to display the content for a single book. This is called single-book.php. If your theme doesn’t have a single-book.php file it will use single.php and if it doesn’t have one of those it will use index.php. The file we need to create is the single-book.php file as that won’t affect blog posts or any other post types.

For more on template fields and how WordPress chooses the best one, take a look at the WordPress Template Hierarchy.

If you already have your own theme you’re using and it’s not one you downloaded or bought, then you can create an extra file in your theme called single-book.php. But if you’re using a third party theme, you’ll find that your new file will be removed if you update the theme at a later date. You can get round this problem by creating a child theme.

Note: I’ll be creating a child of the twenty fifteen theme, which uses include files as well as template files. Your theme may include all the code you need in your template files, in which case don’t create an include file but just edit the template file. This will become more obvious as you read on!

Once you have your child theme in place, make a copy of the single.php file if it has one, or the index.php file if it doesn’t. Call this new file single-book.php. Save the file in your theme folder.

Now open your new file. If you’re working with twenty fifteen (like me), you’ll be able to find a line that reads as follows:

This calls another file which has the code for the loop.

Replace this with the following:

Now instead of calling the content.php file, WordPress will call the content-book.php file at this point. That file doesn’t exist yet so you have to create it!

Make a copy of the content.php file and save it as content-book.php. Save it in the same place as the content.php file. Now open your new file.

Find this code, on line 46:

Now immediately above that line, add this code:

Save your new files and return to your site. If you’ve added shortcodes for the custom fields to any of your books, you’ll need to remove them or the custom fields will be displayed twice. You’ll now find that custom fields are displayed on every book you add:

CustomPress - custom fields displayed on page

Now you can add any styling you want to in your child theme’s stylesheet (such as margins and maybe a border).

Summary

Custom content types are a very powerful and flexible feature of WordPress and they’re what takes it form being a blogging platform to a CMS. But if you’re not comfortable coding them manually, they can seem a bit daunting. Luckily the CustomPress plugin lets you add all three types of custom content whiteout having to write code.

In this post I’ve demonstrated how to add custom post types, custom taxonomies and custom fields using CustomPress and display them on your site. By following these techniques you can create complex and powerful sites with WordPress.

How do you use CustomPress? I’d love to hear about some innovative uses of custom content in the comments below.