Genesis Archive Settings for Custom Post Types

The Genesis theme framework includes an Archive Settings box for specifying the page title and introductory content for category and author archives.

Take a look at my Gutenberg category archive as an example.

Your Custom Post Types 

When registering your own custom post types, you can enable this same functionality by including 'genesis-cpt-archives-settings' in the supports array.  For more information, see my article on creating custom post types.

My Code Snippets post type registration looks like this:

$args = array(
	'labels'              => $labels,
	'hierarchical'        => false,
	'supports'            => array( 'title', 'editor', 'genesis-cpt-archives-settings' ),
	'public'              => true,
	'show_ui'             => true,
	'show_in_rest'        => true,
	'show_in_menu'        => true,
	'show_in_nav_menus'   => true,
	'publicly_queryable'  => true,
	'exclude_from_search' => false,
	'has_archive'         => true,
	'query_var'           => true,
	'can_export'          => true,
	'rewrite'             => true,
	'taxonomies'          => array( 'category' ),
	'menu_icon'           => 'dashicons-media-code',

register_post_type( 'code', $args );

Adding to Plugin CPTs

What if you’re not the one registering the custom post type? In these situations, you can use add_post_type_support().

Here’s how to add support to an event post type registered by another plugin. Place the code in your Core Functionality plugin or your theme’s functions.php file.

 * Add Genesis CPT Archive Settings to events
 * @link
function be_event_archive_settings() {
	add_post_type_support( 'event', 'genesis-cpt-archives-settings' );
add_action( 'init', 'be_event_archive_settings' );

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk

Comments are closed. Continue the conversation with me on Twitter: @billerickson