CPT – Casinos Widget
Creating Casinos Widget CPT
// Register Custom Post Type function cpt_casinos_to_widget() { $labels = array( 'name' => _x( 'Casinos', 'Post Type General Name', 'twentyfifteen' ), 'singular_name' => _x( 'Casino', 'Post Type Singular Name', 'twentyfifteen' ), 'menu_name' => __( 'Casinos Widget', 'twentyfifteen' ), 'name_admin_bar' => __( 'Casinos en widget', 'twentyfifteen' ), 'archives' => __( 'Casinos en archivo', 'twentyfifteen' ), 'attributes' => __( 'Atributos del casino', 'twentyfifteen' ), 'parent_item_colon' => __( 'Cadena', 'twentyfifteen' ), 'all_items' => __( 'Todos', 'twentyfifteen' ), 'add_new_item' => __( 'Agregar nuevo casino', 'twentyfifteen' ), 'add_new' => __( 'Agregar nuevo', 'twentyfifteen' ), 'new_item' => __( 'Nuevo casino', 'twentyfifteen' ), 'edit_item' => __( 'Editar casino', 'twentyfifteen' ), 'update_item' => __( 'Actualizar casino', 'twentyfifteen' ), 'view_item' => __( 'Ver casino', 'twentyfifteen' ), 'view_items' => __( 'Ver casinos', 'twentyfifteen' ), 'search_items' => __( 'Buscar casino', 'twentyfifteen' ), 'not_found' => __( 'Casino no encontrado', 'twentyfifteen' ), 'not_found_in_trash' => __( 'Casino no encontrado en papelera', 'twentyfifteen' ), 'featured_image' => __( 'Imagen destacada', 'twentyfifteen' ), 'set_featured_image' => __( 'Agregar imagen destacada', 'twentyfifteen' ), 'remove_featured_image' => __( 'Remover imagen destacad', 'twentyfifteen' ), 'use_featured_image' => __( 'Usar como imagen destacada', 'twentyfifteen' ), 'insert_into_item' => __( 'Colocar en el casino', 'twentyfifteen' ), 'uploaded_to_this_item' => __( 'Cargado en este casino', 'twentyfifteen' ), 'items_list' => __( 'Listado de casinos', 'twentyfifteen' ), 'items_list_navigation' => __( 'Lista de navegación de casinos', 'twentyfifteen' ), 'filter_items_list' => __( 'Filtrar lista de casinos', 'twentyfifteen' ), ); $args = array( 'label' => __( 'Casino', 'twentyfifteen' ), 'description' => __( 'Custom Post Type to add new cassinos', 'twentyfifteen' ), 'labels' => $labels, 'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields', 'page-attributes' ), 'taxonomies' => array( 'category', 'post_tag', 'link_category' ), 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-money', 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => 'archivo_de_casinos', 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'page', 'show_in_rest' => true, 'rest_base' => 'casinos_widget', 'rest_controller_class' => 'WP_REST_Casinos_Widget_Controller', ); register_post_type( 'casino_to_widget', $args ); } add_action( 'init', 'cpt_casinos_to_widget', 0 );