darrenbachan

Untitled

Jun 7th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.13 KB | None | 0 0
  1. <?php
  2.  
  3. function dbwp_register_post_type() {
  4.  
  5.         $singular = 'Upcoming Game';
  6.         $plural = 'Upcoming Games';
  7.  
  8.         $labels = array(
  9.                 'name'                  => $plural,
  10.                 'singular'              => $singular,
  11.                 'add_name'              => 'Add New',
  12.                 'add_new_item'          => 'Add New  ' . $singular,
  13.                 'edit'                  => 'Edit',
  14.                 'edit_item'             => 'Edit ' . $singular,
  15.                 'new_item'              => 'New ' . $singular,
  16.                 'view'                  => 'View ' . $singular,
  17.                 'view_item'             => 'View ' . $singular,
  18.                 'search_term'           => 'Search ' . $plural,
  19.                 'parent'                => 'Parent ' . $singular,
  20.                 'not_found'             => 'No ' . $plural . ' found',
  21.                 'not_found_in_trash'    => 'No ' . $plural . ' in Trash'
  22.         );
  23.  
  24.         $args = array(
  25.                 'labels'                => $labels,
  26.                 'public'                => true,
  27.                 'publicly_queryable'    => true,
  28.                 'exclude_from_search'   => false,
  29.                 'show_in_nav_menus'     => true,
  30.                 'show_ui'               => true,
  31.                 'show_in_menu'          => true,
  32.                 'show_in_admin_bar'     => true,
  33.                 'menu_position'         => 6,
  34.                 'menu_icon'             => 'dashicons-megaphone',
  35.                 'can_export'            => true,
  36.                 'delete_with_user'      => false,
  37.                 'hierarchical'          => false,
  38.                 'has_archive'           => true,
  39.                 'query_var'             => true,
  40.                 'capability_type'       => 'post',
  41.                 'map_meta_cap'          => true,
  42.                 // 'capabilities' => array(),
  43.                 'rewrite'               => array(
  44.                         'slug'                  => $slug,
  45.                         'with_front'            => true,
  46.                         'pages'                 => true,
  47.                         'feeds'                 => false,
  48.                         ),
  49.                 'supports'              => array(
  50.                         'title',
  51.                         'editor',
  52.                         'author',
  53.                         'thumbnail',
  54.                         'custom-fields'
  55.                 )
  56.         );
  57.  
  58.         register_post_type('upcoming-games', $args);
  59.  
  60. }
  61. add_action('init', 'dbwp_register_post_type');
  62.  
  63. function dbwp_register_category_taxonomy() {
  64.  
  65.         $plural = 'Consoles';
  66.         $single = 'Console';
  67.  
  68.         $labels = array(
  69.                 'name'                      => $plural,
  70.                 'singular_name'             => $singular,
  71.                 'search_items'              => 'Search ' . $plural,
  72.                 'popular_items'             => 'Popular ' . $plural,
  73.                 'all_items'                 => 'All ' . $plural,
  74.                 'parent_item'               => null,
  75.                 'parent_item_colon'         => null,
  76.                 'edit_item'                 => 'Edit ' . $singular,
  77.                 'update_item'               => 'Update ' . $singular,
  78.                 'add_new_item'              => 'Add New ' . $singular,
  79.                 'new_item_name'             => 'New ' . $singular . ' Name',
  80.                 'separate_items_with_commas'=> 'Separate ' . $plural . ' with commas',
  81.                 'add_or_remove_items'       => 'Add or remove ' . $plural,
  82.                 'choose_from_most_used'     => 'Choose from the most used ' . $plural,
  83.                 'not_found'                 => 'No ' . $plural . ' found.',
  84.                 'menu_name'                 => $plural,
  85.         );
  86.  
  87.         $args = array(
  88.                 'hierarchical'          => true,
  89.                 'labels'                => $labels,
  90.                 'show_ui'               => true,
  91.                 'show_admin_column'     => true,
  92.                 'update_count_callback' => '_update_post_term_count',
  93.                 'query var'             => true,
  94.                 'rewrite'               => array( 'slug' => 'consoles'
  95.                 )
  96.         );
  97.         register_taxonomy('consoles', 'upcoming-games', $args);
  98.  
  99. }
  100. add_action('init', 'dbwp_register_category_taxonomy');
  101.  
  102. function dbwp_register_tag_taxonomy() {
  103.  
  104.         $plural = 'Genres';
  105.         $single = 'Genre';
  106.  
  107.         $labels = array(
  108.                 'name'                      => $plural,
  109.                 'singular_name'             => $singular,
  110.                 'search_items'              => 'Search ' . $plural,
  111.                 'popular_items'             => 'Popular ' . $plural,
  112.                 'all_items'                 => 'All ' . $plural,
  113.                 'parent_item'               => null,
  114.                 'parent_item_colon'         => null,
  115.                 'edit_item'                 => 'Edit ' . $singular,
  116.                 'update_item'               => 'Update ' . $singular,
  117.                 'add_new_item'              => 'Add New ' . $singular,
  118.                 'new_item_name'             => 'New ' . $singular . ' Name',
  119.                 'separate_items_with_commas'=> 'Separate ' . $plural . ' with commas',
  120.                 'add_or_remove_items'       => 'Add or remove ' . $plural,
  121.                 'choose_from_most_used'     => 'Choose from the most used ' . $plural,
  122.                 'not_found'                 => 'No ' . $plural . ' found.',
  123.                 'menu_name'                 => $plural,
  124.         );
  125.  
  126.         $args = array(
  127.                 'hierarchical'          => false,
  128.                 'labels'                => $labels,
  129.                 'show_ui'               => true,
  130.                 'show_admin_column'     => true,
  131.                 'update_count_callback' => '_update_post_term_count',
  132.                 'query var'             => true,
  133.                 'rewrite'               => array( 'slug' => 'genres'
  134.                 )
  135.         );
  136.         register_taxonomy('genres', 'upcoming-games', $args);
  137.  
  138. }
  139. add_action('init', 'dbwp_register_tag_taxonomy');
Add Comment
Please, Sign In to add comment