Activate WordPress Portfolio Custom Post Type in 9 Easy Steps in the SEO Book Pro WordPress Template
- ▸ Portfolio Custom Post Type
- ▸ Dashboard
- ▸ Appearance
- ▸ Customize
- ▸ Advanced Custom Post Types Section
- ▸ SEO Book Pro Custom Post Types ( Enable – On/Off)
- ▸ Company Portfolio Custom Post Types ( Enable – On/Off)
- ▸ Select Company Portfolio Custom Post Type Archive Page to Display
- ▸ Publish Changes ( Action – Publish, Save Draft, Schedule )
- ▸ Select Company Portfolio Custom Post Type Archive Page to Display
- ▸ Company Portfolio Custom Post Types ( Enable – On/Off)
- ▸ SEO Book Pro Custom Post Types ( Enable – On/Off)
- ▸ Advanced Custom Post Types Section
- ▸ Customize
- ▸ Appearance
- ▸ Dashboard
Define a custom post type in WordPress using the register_post_type()
function.
register_post_type('portfolio', $args);
This function allows you to define various parameters that control the behavior and appearance of your custom post type. Here’s a list of common parameters you can use:
- label: The plural name of the post type.
- labels: An array of labels for the post type.
- public: Whether the post type is public or not. Default is
false
. - publicly_queryable: Whether the post type is publicly queryable. Default is the value of
public
. - show_ui: Whether to generate a UI for the post type in the admin area. Default is the value of
public
. - show_in_menu: Whether to show the post type in the admin menu. Default is the value of
show_ui
. - show_in_nav_menus: Whether to show the post type in navigation menus. Default is the value of
public
. - show_in_rest: Whether to show in the REST API. Default is the value of
rest_base
. - rest_base: The base slug for the REST API route. Default is the post type name.
- has_archive: Whether the post type should have an archive page. Default is
false
. - rewrite: An array of URL rewrite settings for the post type.
- query_var: The query variable for the post type.
- capability_type: The capability type to use for checking user permissions.
- menu_icon: The icon to use in the admin menu (dashicons or URL).
- supports: An array of supported features (title, editor, author, thumbnail, excerpt, etc.).
- taxonomies: An array of taxonomies to associate with the post type.
- hierarchical: Whether the post type is hierarchical (like pages). Default is
false
. - menu_position: The position in the admin menu. Default is
null
. - exclude_from_search: Whether to exclude the post type from search. Default is the value of
public
.
Here’s an example of how we integrate our SEO Book Pro Custom Post Types ready for use. Some of these parameters to register a custom post type named “Portfolio”: