Documentation › Custom Post Types

Custom Post Types

If you’re using custom post types on your website, here are some things to know about using them with Headway.

Where to Add a Custom Post Type Function

One way to implement custom post types is by manually adding a new function. (An alternative is installing a custom post type plugin.) However, the functions.php file in Headway Base isn’t a good place for this because your changes will be overwritten when you update the theme and you can break Headway and white screen your site.

Instead, create and activate a child theme, and edit the functions.php file in that theme.

Showing Headway SEO Options for Custom Posts

If you add custom post types by editing the functions.php file and you want the Headway SEO meta box to appear when editing your custom posts,
add “headway-seo” to the supported parameters:

'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'headway-seo')

If you wanted to add support for the other Headway meta boxes:

Headway Call/Code Meta Box
headway-admin-meta-box-alternate-title Title Control
headway-admin-meta-box-template Shared Layout
headway-admin-meta-box-post-thumbnail Featured Image position
headway-admin-meta-box-display Custom CSS Class(es)
headway-seo SEO

Displaying a Custom Post Loop

Posts with a custom type won’t appear in the default loop on your blog index. But since the purpose of custom post types is to separate them from the regular posts, you can display the custom posts either on a page or as an archive. The method you choose depends mostly on how you want layout inheritance to affect the display—in other words, do you want the custom post types to look like your other WordPress pages or your other
archives?

Note: Posts with a custom type also don’t appear in your RSS feed. See this wpbeginner article to add them.

Page Method

  1. Create a page in WordPress for your posts.
  2. In Grid Mode of the Visual Editor, set up a custom query for the content block. The query should get posts of your custom type.
  3. In WordPress, add a navigation menu item that points to the page.

Archive Method

  1. In Grid Mode, verify that your custom post layout is inheriting a layout where the content block is using the default query.
  2. In WordPress, add a navigation menu item that points to the archive.

This article was last updated for Headway version 3.8.3

Copyright © 2016 Vesped Inc. All Rights Reserved. Proudly Powered by Headway and WordPress