Pro registrování nové custom post type stačí nahradit v celém kódu sample_post_type na název vašeho nového custom post type.

Soubor vložíme do functions.php.

<?php
add_action( 'init', 'register_cpt_sample_post_type' );

function register_cpt_sample_post_type() {

    $labels = array( 
        'name' => _x( 'Sample post type', 'sample_post_type' ),
        'singular_name' => _x( 'Sample post type', 'sample_post_type' ),
        'add_new' => _x( 'Přidat nový', 'sample_post_type' ),
        'add_new_item' => _x( 'Přidat nový', 'sample_post_type' ),
        'edit_item' => _x( 'Upravit', 'sample_post_type' ),
        'new_item' => _x( 'Nový', 'sample_post_type' ),
        'view_item' => _x( 'Zobrazit', 'sample_post_type' ),
        'search_items' => _x( 'Vyhledávat', 'sample_post_type' ),
        'not_found' => _x( 'Nic nenalezeno', 'sample_post_type' ),
        'not_found_in_trash' => _x( 'Nic nenalezeno v koši', 'sample_post_type' ),
        'parent_item_colon' => _x( 'Nadřazené', 'sample_post_type' ),
        'menu_name' => _x( 'Sample post type', 'sample_post_type' ),
    );

    $args = array( 
        'labels' => $labels,
        'hierarchical' => false,
        'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes' ),
        'taxonomies' => array( '' ),
        'public' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'menu_position' => 5,
        'menu_icon' => '', // http://melchoyce.github.io/dashicons/
        'show_in_nav_menus' => true,
        'publicly_queryable' => true,
        'exclude_from_search' => false,
        'has_archive' => true,
        'query_var' => true,
        'can_export' => true,
        'rewrite' => true,
        'capability_type' => 'post'
    );

    register_post_type( 'sample_post_type', $args );
}