headerIMG

B2B Articles - February 05, 2014 - By Ironpaper

Developing a Wordpress custom post type

Wordpress web designCustom post types allow developers to extend the Wordpress platform to allow for different types of content to plugins and themes. Simply stated, a custom post type is a special type of content defined by a web developer for a website. Web developers can define both the properties of that content and the design of the content for frontend users. Often times people are confused about the term "post type." Custom posts do not just imply blog posts, Wordpress comes with a number of default post types natively.

Default Wordpress post types

  • Posts
  • Pages
  • Attachments
  • Revisions
  • Navigation menu items

Creating a custom post type in Wordpress

The Wordpress platform makes it easy to program new post (content) types and add them to a website. You will need to define the new post type inside the functions.php file inside your theme.

add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'acme_members',
array(
'labels' => array(
'name' => __( 'Members' ),
'singular_name' => __( 'Member' )
),
'public' => true,
'has_archive' => true,
)
);
}

That's it. This statement creates a new post type called Member, which can be used to create a member database. This is the start of using Wordpress to develop a membership website. Certainly a lot more options can be added to our post type called "Member." The options can include setting Admin labels as well as adding additional fields. It is a good idea to prefix any post type created with a unique naming convention to prevent conflicts with other plugins.

Viewing the new post-type as an archive (list) page:

archive-{posttype}.php

This article is meant to be a quick reference for Wordpress web developers and not an extensive guide.

Tel 212-993-7809  

Ironpaper ®
10 East 33rd Street 
6th Floor
New York, NY 10016
Map

Ironpaper - B2B Agency

B2B Marketing and Growth Agency.

Grow your B2B business boldly. Ironpaper is a B2B marketing agency. We build growth engines for marketing and sales success. We drive demand generation campaigns, ABM programs, B2B content, sales enablement, qualified leads, and B2B marketing efforts. 

Ironpaper Twitter Ironpaper Linkedin