-
-
Save krafit/cf245e1e1723b5bde4c48717e31d8277 to your computer and use it in GitHub Desktop.
Example Custom-Post-Type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: KrautPress-Workshops | |
* Plugin URI: https://krautpress.de/ | |
* Version: 0.1 | |
* Text Domain: kp_workshops | |
* Domain Path: /languages | |
**/ | |
// Register Custom Post Type | |
function kp_workshops() { | |
$args = array( | |
'label' => __( 'Workshop', 'kp_workshops' ), | |
'description' => __( 'Workshop listing', 'kp_workshops' ), | |
'labels' => $labels, | |
'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'revisions', 'custom-fields' ), | |
'taxonomies' => array( 'category' ), | |
'hierarchical' => false, | |
'public' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'menu_position' => 20, | |
'menu_icon' => 'dashicons-welcome-learn-more', | |
'show_in_admin_bar' => true, | |
'show_in_nav_menus' => true, | |
'can_export' => true, | |
'has_archive' => true, | |
'exclude_from_search' => false, | |
'publicly_queryable' => true, | |
'capability_type' => 'page', | |
'show_in_rest' => true, | |
); | |
$labels = array( | |
'name' => _x( 'Workshops', 'Post Type General Name', 'kp_workshops' ), | |
'singular_name' => _x( 'Workshop', 'Post Type Singular Name', 'kp_workshops' ), | |
'menu_name' => __( 'Workshops', 'kp_workshops' ), | |
'name_admin_bar' => __( 'Workshops', 'kp_workshops' ), | |
'archives' => __( 'Workshop Archives', 'kp_workshops' ), | |
'attributes' => __( 'Workshop Attributes', 'kp_workshops' ), | |
'parent_item_colon' => __( 'Parent Workshop:', 'kp_workshops' ), | |
'all_items' => __( 'All Workshops', 'kp_workshops' ), | |
'add_new_item' => __( 'Add New Workshop', 'kp_workshops' ), | |
'add_new' => __( 'Add New', 'kp_workshops' ), | |
'new_item' => __( 'New Workshop', 'kp_workshops' ), | |
'edit_item' => __( 'Edit Workshop', 'kp_workshops' ), | |
'update_item' => __( 'Update Workshop', 'kp_workshops' ), | |
'view_item' => __( 'View Workshop', 'kp_workshops' ), | |
'view_items' => __( 'View Workshops', 'kp_workshops' ), | |
'search_items' => __( 'Search Workshop', 'kp_workshops' ), | |
'not_found' => __( 'Not found', 'kp_workshops' ), | |
'not_found_in_trash' => __( 'Not found in Trash', 'kp_workshops' ), | |
'featured_image' => __( 'Workshop Image', 'kp_workshops' ), | |
'set_featured_image' => __( 'Set workshop image', 'kp_workshops' ), | |
'remove_featured_image' => __( 'Remove workshop image', 'kp_workshops' ), | |
'use_featured_image' => __( 'Use as workshop image', 'kp_workshops' ), | |
'insert_into_item' => __( 'Insert into Workshop', 'kp_workshops' ), | |
'uploaded_to_this_item' => __( 'Uploaded to this Workshop', 'kp_workshops' ), | |
'items_list' => __( 'Workshops list', 'kp_workshops' ), | |
'items_list_navigation' => __( 'Workshops list navigation', 'kp_workshops' ), | |
'filter_items_list' => __( 'Filter Workshops list', 'kp_workshops' ), | |
); | |
register_post_type( 'workshops', $args ); | |
} | |
add_action( 'init', 'kp_workshops', 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment