Nico Morgan Media logo

Working with Custom Post Types

Topic:

WordPress comes with post types called Posts and Pages.

Posts are news articles or blogs which have a Title, content and a Featured Image. The main article content is like a newspaper article and doesn't include lots of design elements.

Pages are more static and permanent elements of a website. The Home Page, Contact Us and FAQ pages of a website are examples of Pages. Pages have titles and content but don't normally need a Featured Image.

Introducing custom post types

Depending on the type of site you have, I may have created extra post type for you, called Custom Post Types, or CPTs. Custom post types can be created with some or all of the usual features like an Excerpt, Featured Image and taxonomies like categories and tags.

Most importantly though, a custom post type can be given custom fields too. This is slightly unusual so let me give you some examples.

An equestrian website might include a set of horses. We could create the horses as a normal post but each horse has details about it which we want to easily add when editing the horse so it is easier if we set "Horses" up as a separate Custom Post Type. We can then include fields like Age, Colour, Height, Competition Level, Sire, Dam and so on as Custom Fields which are entered using the WordPress interface.

In my previous article Introduction to the WordPress Dashboard I included a screenshot from Midlands Pointing, a website which manages point-to-point racing in one region of England.

The WordPress Dashboard
The Midlands Pointing Dashboard

As you can see in the left-hand WordPress menu, the usual post types of posts and pages are there, but there are also CPTs for Fixtures, Going Reports, Courses and Sponsors each of which has specific custom fields relevant to them.

Here is the post editing interface for Courses:

Editing a custom post type showing custom fields

You can see the usual content area at the top of the screen and the right-hand looks similar to editing a normal blog post. However, below the content area you can see that there are extra fields to fill in called Meetings, Address, Website, What3words and Clerk of the Course. The website uses these fields to display a page for each course which includes lots of useful information.

On the public facing side of the website, the information is laid out by a specially designed template to use all that custom info:

a custom post type example from the web site front end

Adding a new Custom Post

Adding a new custom post is very much the same as adding a blog or news article.

Find the custom post type in the left-hand WordPress menu and hover your mouse over the Name of the CPT. Choose Add New from the pop-up list which appears.

We start by adding a Title, Featured Image, Content and any taxonomies like a Category.

Then, depending on the custom post type, we should add extra information into the custom fields which are displayed below the content area.

Here's the thing. If we don't fill in these fields then there may be missing info on the post when it is displayed on the website.

Once you are happy that you have completed as much information as possible we are ready to Publish this new custom post using the Publish button in the top right of your screen.

Editing a Custom Post

When I first create your website I will create the custom post types and the custom fields and populate them with the data which goes on the website to start with. So far so good.

However, it won't be long before you will want to edit some of that data yourself because things change.

Let's use Horses as an example as above.

Find the custom post type in the left-hand WordPress menu and hover your mouse over the Name of the CPT, in this case Horses.

Choose All Horses from the pop-up list which appears.

WordPress will now present you with a list of the existing Horse custom posts which have already been added.

Find the one you wish to edit and move your mouse over it. A menu will appear and you can choose Edit from that menu.

Make the required changes to the custom post and click the Update button when you are finished.

Leave a Reply

Your email address will not be published. Required fields are marked *

About Nico

I am an equine photographer, website designer and hosting provider living in Lincolnshire.

I work with clients who are sole traders and others which are FTSE companies. They are equally important to me.

If you need commercial photographyeditorial photography, event photography, lifestyle, equestrian or wedding photography, then I can help you, with over 30 years experience in these areas.

I also teach photography. I mentor photographers with a range of experience, from beginners to working professionals and run an equine photography course which gives members access to articles about the business of equestrian photography.

I have a varied set of skills, having worked for well known web design, SEO and analytics companies in parallel to my photography.

I design, host and maintain websites for clients as varied as farms, interior designers and equestrian centres, as well as for bloggers and sportspeople, including many riders.

I am the Public Relations Officer for the Midlands Area Point-to-Point Association, a role which utilises my PR and social media skills to promote horse racing both online and in the National press.

If you think that I could be the right person to help you, whatever your project, then please get in touch and we can discuss what you need and the ways in which I can help.

You can find out more about me here.

cross linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram