Advertisement
Guest User

Untitled

a guest
Jun 14th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.39 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Registers a new post type
  5.  * @uses $wp_post_types Inserts new post type object into the list
  6.  *
  7.  * @param string  Post type key, must not exceed 20 characters
  8.  * @param array|string  See optional args description above.
  9.  * @return object|WP_Error the registered post type object, or an error object
  10.  */
  11. function dzmitrockpress_css_post() {
  12.  
  13.     $labels = array(
  14.         'name'               =>  'Css свойства',
  15.         'singular_name'      =>  'Css свойство',
  16.         'add_new'            =>  'Добавить Css свойство',
  17.         'add_new_item'       =>  'Добавить Css свойство',
  18.         'edit_item'          =>  'Редактировать Css свойство',
  19.         'new_item'           =>  'Новое Css свойство',
  20.         'view_item'          =>  'Смотреть Css свойство',
  21.         'search_items'       =>  'Искать Css свойства',
  22.         'not_found'          =>  'Не найдено Css свойств',
  23.         'not_found_in_trash' =>  'Не найдено Css свойства в корзине',
  24.         'parent_item_colon'  =>  'Дочернее Css свойство:',
  25.         'menu_name'          =>  'Css свойства',
  26.     );
  27.  
  28.     $args = array(
  29.         'labels'              => $labels,
  30.         'hierarchical'        => false,
  31.         'description'         => 'Css свойства',
  32.         'taxonomies'          => array('css-category'),
  33.         'public'              => true,
  34.         'show_ui'             => true,
  35.         'show_in_menu'        => true,
  36.         'show_in_admin_bar'   => true,
  37.         'menu_position'       => null,
  38.         'menu_icon'           => 'dashicons-star-empty',
  39.         'show_in_nav_menus'   => true,
  40.         'publicly_queryable'  => true,
  41.         'exclude_from_search' => false,
  42.         'has_archive'         => true,
  43.         'query_var'           => true,
  44.         'can_export'          => true,
  45.         'rewrite'             => true,
  46.         'show_in_rest'        => true,
  47.         'capability_type'     => 'post',
  48.         'supports'            => array(
  49.             'title',
  50.             'editor',
  51.             'author',
  52.             'thumbnail',
  53.             'excerpt',
  54.             'custom-fields',
  55.             'trackbacks',
  56.             'comments',
  57.             'revisions',
  58.             'page-attributes',
  59.             'post-formats',
  60.         ),
  61.     );
  62.  
  63.     register_post_type( 'css', $args );
  64. }
  65.  
  66. add_action( 'init', 'dzmitrockpress_css_post' );
  67.  
  68.  
  69. /**
  70.  * Create a taxonomy
  71.  *
  72.  * @uses  Inserts new taxonomy object into the list
  73.  * @uses  Adds query vars
  74.  *
  75.  * @param string  Name of taxonomy object
  76.  * @param array|string  Name of the object type for the taxonomy object.
  77.  * @param array|string  Taxonomy arguments
  78.  * @return null|WP_Error WP_Error if errors, otherwise null.
  79.  */
  80. function tax_css_category() {
  81.  
  82.     $labels = array(
  83.         'name'                  => _x( 'Рубрика свойства', 'Taxonomy plural name', 'text-domain' ),
  84.         'singular_name'         => _x( 'Рубрики свойства', 'Taxonomy singular name', 'text-domain' ),
  85.         'search_items'          => __( 'Search Рубрика свойства', 'text-domain' ),
  86.         'popular_items'         => __( 'Popular Рубрика свойства', 'text-domain' ),
  87.         'all_items'             => __( 'All Рубрика свойства', 'text-domain' ),
  88.         'parent_item'           => __( 'Parent Рубрики свойства', 'text-domain' ),
  89.         'parent_item_colon'     => __( 'Parent Рубрики свойства', 'text-domain' ),
  90.         'edit_item'             => __( 'Edit Рубрики свойства', 'text-domain' ),
  91.         'update_item'           => __( 'Update Рубрики свойства', 'text-domain' ),
  92.         'add_new_item'          => __( 'Add New Рубрики свойства', 'text-domain' ),
  93.         'new_item_name'         => __( 'New Рубрики свойства Name', 'text-domain' ),
  94.         'add_or_remove_items'   => __( 'Add or remove Рубрика свойства', 'text-domain' ),
  95.         'choose_from_most_used' => __( 'Choose from most used Рубрика свойства', 'text-domain' ),
  96.         'menu_name'             => __( 'Рубрики свойства', 'text-domain' ),
  97.     );
  98.  
  99.     $args = array(
  100.         'labels'            => $labels,
  101.         'public'            => true,
  102.         'show_in_nav_menus' => true,
  103.         'show_admin_column' => false,
  104.         'hierarchical'      => true,
  105.         'show_tagcloud'     => true,
  106.         'show_ui'           => true,
  107.         'query_var'         => true,
  108.         'rewrite'           => true,
  109.         'query_var'         => true,
  110.         'capabilities'      => array(),
  111.     );
  112.  
  113.     register_taxonomy( 'css_category', array( 'css' ), $args );
  114. }
  115.  
  116. add_action( 'init', 'tax_css_category' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement