Skip to content

Instantly share code, notes, and snippets.

@montrealist
Created July 29, 2020 16:34
Show Gist options
  • Select an option

  • Save montrealist/9803a56d6640d85b04416a1246a8fbe5 to your computer and use it in GitHub Desktop.

Select an option

Save montrealist/9803a56d6640d85b04416a1246a8fbe5 to your computer and use it in GitHub Desktop.

Revisions

  1. montrealist created this gist Jul 29, 2020.
    48 changes: 48 additions & 0 deletions cpt-definition.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    <?php

    register_post_type( 'tutorial', array(
    'labels' => array(
    'name' => __( 'Tutoriais' ),
    'singular_name' => __( 'Tutorial' ),
    'add_new' => __( 'Criar Novo' ),
    'add_new_item' => __( 'Criar Novo Tutorial' ),
    'edit_item' => __( 'Editar Tutorial' ),
    'new_item' => __( 'Novo Tutorial' ),
    'view_item' => __( 'Ver Tutorial' ),
    'search_items' => __( 'Procurar Tutoriais' ),
    'not_found' => __( 'Nenhum Tutorial encontrado' ),
    'not_found_in_trash' => __( 'Nenhum Tutorial encontrado no Lixo' ),
    'parent_item_colon' => __( 'Tutorial Anterior' ),
    'menu_name' => __( 'Tutoriais' ),
    'name_admin_bar' => _x( 'Tutorial', 'add new on admin bar' ),

    ),
    'description' => __( 'AppTuts Tutorials Section' ),
    'public' => true,
    'publicly_queryable' => true,
    'exclude_from_search' => false,
    'show_ui' => true,
    'show_in_menu' => true,
    'menu_position' => 5,
    'menu_icon' => '',
    'capability_type' => 'tutorial',
    'capabilities' => array(
    'edit_post' => 'edit_tutorial',
    'edit_posts' => 'edit_tutorials',
    'edit_others_posts' => 'edit_others_tutorials',
    'publish_posts' => 'publish_tutorials',
    'read_post' => 'read_tutorial',
    'read_private_posts' => 'read_private_tutorials',
    'delete_post' => 'delete_tutorial'
    ),
    'has_archive' => 'tutorial/%category%',
    'query_var' => true,
    'rewrite' => array( 'slug' => 'tutorial/%category%', 'with_front' => false ),
    'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields', 'revisions', 'post-formats', 'author', 'comments', 'trackbacks' ),
    'hierarchical' => false,
    'taxonomies' => array( 'post_tag', 'category' ),
    'can_export' => true,
    'show_in_nav_menus' => true,
    )

    );