Skip to content

Instantly share code, notes, and snippets.

@kharakhordindemo
Created December 19, 2017 09:51
Show Gist options
  • Save kharakhordindemo/b85f03aba80182ec851e7f12c2f0d4d1 to your computer and use it in GitHub Desktop.
Save kharakhordindemo/b85f03aba80182ec851e7f12c2f0d4d1 to your computer and use it in GitHub Desktop.
Custom Post Type
<?php
/*Custom Post Type*/
function art_register_post_type() {
$singular = 'Job';
$plural = 'Jobs';
$labels = array(
'name' => $plural,
'singular_name' => $singular,
'add_new' => 'Add New',
'add_new_item' => 'Add New ' . $singular,
'edit' => 'Edit',
'edit_item' => 'Edit ' . $singular,
'new_item' => 'New ' . $singular,
'view' => 'View ' . $singular,
'view_item' => 'View ' . $singular,
'search_term' => 'Search ' . $plural,
'parent' => 'Parent ' . $singular,
'not_found' => 'No ' . $plural .' found',
'not_found_in_trash' => 'No ' . $plural .' in Trash'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'show_in_nav_menus' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_admin_bar' => true,
'menu_position' => 10,
'menu_icon' => 'dashicons-businessman',
'can_export' => true,
'delete_with_user' => false,
'hierarchical' => false,
'has_archive' => true,
'query_var' => true,
'capability_type' => 'post',
'map_meta_cap' => true,
// 'capabilities' => array(),
'rewrite' => array(
'slug' => 'job',
'with_front' => true,
'pages' => true,
'feeds' => true,
),
'supports' => array(
'title',
'editor',
'author',
'custom-fields'
)
);
register_post_type( 'job_list', $args );
}
add_action( 'init', 'art_register_post_type' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment