Enable Content Types (Archive & Single)

Enable Mai Theme's Customizer layout and style settings for various archive and single content types.

Content Archives settings allow you to control the way content displays on blog, custom post type, category, tag, author, date, and taxonomy archive pages, whether all of the same or independent of one another. Want your blog archive/page to look different than your category, tag, or search results? This is the place.

Single Content settings allow you to control the way content displays on each individual content type page. This could be each individual post, page, custom post type, etc.

Every Mai Theme has one or more content types enabled by default, but you can add as many as you’d like here.

How To Enable Content Types

Start by enabling any archive content type that you want to customize. Custom post types must support mai-archive-settings and/or mai-single-settings to be available here.

Refresh after updating! In order to show/hide panels for the updated values you must reload the Customizer.

  1. View Customizer > Theme Settings, then either Content Archives or Single Content > Enable Content Types.
  2. Check to enable any content types to use our customization settings.
  3. Publish/save.
  4. Refresh the page.
  5. View Customizer > Theme Settings, then either Content Archives or Single Content to start customizing.

Content Archives Settings

Content Archives settings allow you to control the way content displays on each single content type page.

Single Content Settings

Single Content settings allow you to control the way content displays on each single content type page.

Screenshots

Enable Settings with Code

To enable Mai Archive/Single settings on a custom post type that isn't directly supported, you can use either of the following PHP snippets in functions.php.

Using the register_post_type_args filter:

/**
 * Add Mai Archive/Single Customizer settings to a CPT.
 * 
 * @param array  $args      The existing post type args.
 * @param string $post_type The registered post type name.
 * 
 * @return array
 */
add_filter( 'register_post_type_args', function( $args, $post_type ) {
	// If this is the correct post type.
	if ( 'my_cpt' === $post_type ) {
		// Add additional supports.
		$args['supports'][] = 'mai-archive-settings';
		$args['supports'][] = 'mai-single-settings';
	}
	
	return $args;

}, 20, 2 );

Using the add_post_type_support() function:

/**
 * Add Mai Archive/Single Customizer settings to a CPT.
 * 
 * @return void
 */
add_action( 'after_setup_theme', function() {
	add_post_type_support( 'my_cpt', 'mai-archive-settings' );
	add_post_type_support( 'my_cpt', 'mai-single-settings' );
});
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us