Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

CPT para MBM

if ( ! function_exists('jem_mbm_post_type') ) {

// Register Custom Post Type
function jem_mbm_post_type() {

	$labels = array(
		'name'                  => _x( 'MBMs', 'Post Type General Name', 'jem_mbm_post_type' ),
		'singular_name'         => _x( 'MBM', 'Post Type Singular Name', 'jem_mbm_post_type' ),
		'menu_name'             => __( 'MBM', 'jem_mbm_post_type' ),
		'name_admin_bar'        => __( 'MBM', 'jem_mbm_post_type' ),
		'archives'              => __( 'Archivos MBM', 'jem_mbm_post_type' ),
		'attributes'            => __( 'Atributo MBM', 'jem_mbm_post_type' ),
		'parent_item_colon'     => __( 'MBM Item padre:', 'jem_mbm_post_type' ),
		'all_items'             => __( 'Todos los MBMs', 'jem_mbm_post_type' ),
		'add_new_item'          => __( 'Añadir un nuevo MBM', 'jem_mbm_post_type' ),
		'add_new'               => __( 'Añadir Nuevo MBM', 'jem_mbm_post_type' ),
		'new_item'              => __( 'Nuevo MBM', 'jem_mbm_post_type' ),
		'edit_item'             => __( 'Editar MBM', 'jem_mbm_post_type' ),
		'update_item'           => __( 'Actualizar MBM', 'jem_mbm_post_type' ),
		'view_item'             => __( 'Ver MBM', 'jem_mbm_post_type' ),
		'view_items'            => __( 'Ver MBMs', 'jem_mbm_post_type' ),
		'search_items'          => __( 'Buscar MBM', 'jem_mbm_post_type' ),
		'not_found'             => __( 'No encontrado', 'jem_mbm_post_type' ),
		'not_found_in_trash'    => __( 'No encontrado en la papelera', 'jem_mbm_post_type' ),
		'featured_image'        => __( 'Imagen destacada MBM', 'jem_mbm_post_type' ),
		'set_featured_image'    => __( 'Establecer imagen destacada MBM', 'jem_mbm_post_type' ),
		'remove_featured_image' => __( 'Eliminar imagen destacada MBM', 'jem_mbm_post_type' ),
		'use_featured_image'    => __( 'Usar como imagen destacada MBM', 'jem_mbm_post_type' ),
		'insert_into_item'      => __( 'Insertar en MBM', 'jem_mbm_post_type' ),
		'uploaded_to_this_item' => __( 'Subido a este MBM', 'jem_mbm_post_type' ),
		'items_list'            => __( 'Listado de MBM', 'jem_mbm_post_type' ),
		'items_list_navigation' => __( 'Navegación de listado MBM', 'jem_mbm_post_type' ),
		'filter_items_list'     => __( 'FIltro de lista de MBM', 'jem_mbm_post_type' ),
	);
	$args = array(
		'label'                 => __( 'MBM', 'jem_mbm_post_type' ),
		'description'           => __( 'Aquí se añadirán los vídeos MBM', 'jem_mbm_post_type' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'thumbnail', 'custom-fields', 'page-attributes', 'post-formats' ),
		'taxonomies'            => array( 'category', 'post_tag' ),
		'hierarchical'          => false,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 5,
		'menu_icon'             => 'dashicons-format-video',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => true,
		'can_export'            => true,
		'has_archive'           => 'mbm',
		'exclude_from_search'   => false,
		'publicly_queryable'    => true,
		'capability_type'       => 'post',
		'show_in_rest'          => true,
	);
	register_post_type( 'mbm_post_type', $args );

}
add_action( 'init', 'jem_mbm_post_type', 0 );

}