Skip to content

Instantly share code, notes, and snippets.

@ostryweb-cz
Created December 29, 2012 11:27
Show Gist options
  • Save ostryweb-cz/4406286 to your computer and use it in GitHub Desktop.
Save ostryweb-cz/4406286 to your computer and use it in GitHub Desktop.
wordpress custom post type example czech blog.ostryweb.cz
function muj_add_post_type() {
register_post_type( 'muj_document',
array(
'labels' => array(
'name' => 'Dokument',
'singular_name' => 'Dokument',
'add_new' => 'Přidat dokument',
'add_new_item' => 'Přidat nový dokument',
'edit' => 'Upravit',
'edit_item' => 'Upravit dokument',
'new_item' => 'Nový dokument',
'view' => 'Zobrazit',
'view_item' => 'Zobrazit dokument',
'search_items' => 'Hledat v dokumentech',
'not_found' => 'Žádný dokument nenalezen',
'not_found_in_trash' => 'Žádný dokument v koši nenalezen',
'parent' => 'Nadřazený dokument'
),
'public' => true,
'publicly_queryable' => false,
'exclude_from_search' => true,
'show_in_nav_menus' => false,
'capability_type' => 'muj_document',
'capabilities' => array(
'read_post' => 'read_muj_document',
'edit_post' => 'edit_muj_document',
'read_private_posts' => 'read_private_muj_documents',
'edit_posts' => 'edit_muj_documents',
'edit_others_posts' => 'edit_others_muj_documents',
'edit_published_posts' => 'edit_published_muj_documents',
'publish_posts' => 'publish_muj_documents',
'delete_posts' => 'delete_muj_documents',
'delete_others_posts' => 'delete_others_muj_documents',
'delete_post' => 'delete_muj_document',
),
'map_meta_cap' => true,
'menu_position' => 2,
'supports' => array( 'title', 'author', 'revisions' ),
'menu_icon' => plugins_url( 'img/menulogo.png', __FILE__ ),
'can_export' => false
)
);
}
add_action('init', 'muj_add_post_type', 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment