Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

CPT Notícies de la comunitat

if ( ! function_exists('noticies_post_type') ) {

// Register Custom Post Type
function noticies_post_type() {

	$labels = array(
		'name'                  => _x( 'Notícies', 'Post Type General Name', 'noticies_domain' ),
		'singular_name'         => _x( 'Notícia', 'Post Type Singular Name', 'noticies_domain' ),
		'menu_name'             => __( 'Notícies', 'noticies_domain' ),
		'name_admin_bar'        => __( 'Notícies', 'noticies_domain' ),
		'archives'              => __( 'Arxius de notícies', 'noticies_domain' ),
		'attributes'            => __( 'Atributs de notícia', 'noticies_domain' ),
		'parent_item_colon'     => __( 'Pare de notícia:', 'noticies_domain' ),
		'all_items'             => __( 'Totes les notícies', 'noticies_domain' ),
		'add_new_item'          => __( 'Agregar nova notícia', 'noticies_domain' ),
		'add_new'               => __( 'Agregar nova', 'noticies_domain' ),
		'new_item'              => __( 'Nova notícia', 'noticies_domain' ),
		'edit_item'             => __( 'Editar notícia', 'noticies_domain' ),
		'update_item'           => __( 'Modificar notícia', 'noticies_domain' ),
		'view_item'             => __( 'Vore notícia', 'noticies_domain' ),
		'view_items'            => __( 'Vore notícies', 'noticies_domain' ),
		'search_items'          => __( 'Buscar notícia', 'noticies_domain' ),
		'not_found'             => __( 'No trobada', 'noticies_domain' ),
		'not_found_in_trash'    => __( 'No trobada en papelera', 'noticies_domain' ),
		'featured_image'        => __( 'Imatge destacada', 'noticies_domain' ),
		'set_featured_image'    => __( 'Establir imatge destacada', 'noticies_domain' ),
		'remove_featured_image' => __( 'Eliminar imatge destacada', 'noticies_domain' ),
		'use_featured_image'    => __( 'Usar com imatge destacada', 'noticies_domain' ),
		'insert_into_item'      => __( 'Insertar en notícia', 'noticies_domain' ),
		'uploaded_to_this_item' => __( 'Putjar a la notícia', 'noticies_domain' ),
		'items_list'            => __( 'Llista de notícies', 'noticies_domain' ),
		'items_list_navigation' => __( 'Navegació per la llista de notícies', 'noticies_domain' ),
		'filter_items_list'     => __( 'Filtrar la llista de notícies', 'noticies_domain' ),
	);
	$rewrite = array(
		'slug'                  => 'noticia',
		'with_front'            => true,
		'pages'                 => true,
		'feeds'                 => true,
	);
	$args = array(
		'label'                 => __( 'Notícia', 'noticies_domain' ),
		'description'           => __( 'Notícies de la comunitat', 'noticies_domain' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'thumbnail', 'custom-fields' ),
		'taxonomies'            => array( 'category' ),
		'hierarchical'          => true,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 60,
		'menu_icon'             => 'dashicons-text-page',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => true,
		'can_export'            => true,
		'has_archive'           => true,
		'exclude_from_search'   => false,
		'publicly_queryable'    => true,
		'rewrite'               => $rewrite,
		'capability_type'       => 'page',
		'show_in_rest'          => true,
	);
	register_post_type( 'noticies', $args );

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

}