You will need to know how to create custom post types to understand this tutorial. This tutorial does not cover creating your own Custom Post Types.
You’ll notice that when creating/editing Posts and Pages in WordPress, there are some Headway specific metaboxes:
- Title Control
- Shared Layout
- Featured Image Position
- SEO (if using Headway’s SEO options)
- Custom CSS Class(es)
These meta boxes do not show up when creating/editing Custom Post Types (CPT) unless you add support for it. So the question is.. how? The method depends on whether you want to add support for all Custom Post Types or just certain ones and whether you want to enable all meta boxes, or just some.
First things first
The things you need to know are:
headway-admin-meta-box-post-thumbnail corresponds to the Featured Image meta box
headway-admin-meta-box-display corresponds to the Custom CSS Class(es) meta box
headway-seo corresponds to the Headway SEO meta box
Manually created CPT
Either with a child theme or custom site plugin (not a pre-built plugin)
You can create CPT by adding the code to your child theme
functions.php or you can also create your own custom site plugin and place the code to create your custom post type. Whatever method you choose, you need to add additional items to the
supports array for your CPT might look like this
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments')
If you wanted to add support for Headway’s Title Control meta box to your CPT, you would need to add
headway-admin-meta-box-alternate-title to the
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'headway-admin-meta-box-alternate-title')
Pre-built Plugin created CPT
A plugin you downloaded from repository or purchased, not one you created yourself
If you are using a pre-built plugin to create your CPT (examples include Types, CPT UI, More Types, etc), unless the plugin has an option to declare support for the Headway meta boxes (for example, although an older plugin, More Types allows this), you will need a child theme or a custom site plugin to add support for the Headway meta boxes.
You can’t just edit the plugin to add the support because upon upgrade of the plugin, you will lose your changes.
So, for example, if you wanted to declare support for Headway’s Shared Layout meta box, here’s the code you would use
product is the slug of your CPT (this is the slug created by WooCommerce). To add support for more meta boxes, you could add to it. To declare support for the Shared Layout and Title Control metaboxes:
Noting that you would have to repeat this for each CPT/meta box combination. If, instead, you wanted to have every CPT that you have support the Headway meta boxes:
This code loops though all CPT and adds support for all Headway meta boxes to all post types.
If you wanted to only add certain meta boxes to all post types, then you can remove the ones corresponding to the appropriate meta box.
Any questions? Ask in the comments or start a thread in the forum!