<?php

add_action( 'init', 'create_post_type_reviews', 0 );
function create_post_type_reviews() {
 
    $labels = array(
        'name'                => _x( 'Reviews', 'Post Type General Name', 'felicityhealth' ),
        'singular_name'       => _x( 'Review', 'Post Type Singular Name', 'felicityhealth' ),
        'menu_name'           => __( 'Reviews', 'felicityhealth' ),
        'parent_item_colon'   => __( 'Parent Review:', 'felicityhealth' ),
        'all_items'           => __( 'All Review', 'felicityhealth' ),
        'view_item'           => __( 'View Review', 'felicityhealth' ),
        'add_new_item'        => __( 'Add New Review', 'felicityhealth' ),
        'add_new'             => __( 'Add New Review', 'felicityhealth' ),
        'edit_item'           => __( 'Edit Review', 'felicityhealth' ),
        'update_item'         => __( 'Update Review', 'felicityhealth' ),
        'search_items'        => __( 'Search Review', 'felicityhealth' ),
        'not_found'           => __( 'No reviews found', 'felicityhealth' ),
        'not_found_in_trash'  => __( 'No reviews found in trash', 'felicityhealth' ),
    );
    $args = array(
        'label'               => __( 'Reviews', 'felicityhealth' ),
        'description'         => __( 'Reviews Description', 'felicityhealth' ),
        'labels'              => $labels,
        'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'revisions', 'custom-fields', 'permalinks', 'featured_image' ),
        'show_in_rest'        => true,
        // 'taxonomies'          => array( 'category' ),
        'hierarchical'        => false,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'menu_position'       => 5,
        'menu_icon'           => 'dashicons-format-quote',
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'capability_type'     => 'page'

    );
    register_post_type( 'reviews', $args );
}

  // Reviews categories
  add_action( 'init', 'register_taxonomy_review_category', 0 );

  function register_taxonomy_review_category() {

      $labels = array(
          // See list of labels in docs I linked above (bold and blue "here")     
      );
      $args = array(  

          // Custom labels? Remove them all to get "default"
          'labels'              => $labels,
          // Does these have child-parent relationships?
          'hierarchical'        => true,
          // Translatable pretty slugs?
          'rewrite'             => array( 'slug' => __( 'review-category', 'review' ) ),
          // Generate a default UI for managing this taxonomy?
          'show_ui'             => true,
          // Allow automatic creation of taxonomy columns on associated post-types table?
          'show_admin_column'   => true,
          // Show in quick edit panel?
          'show_in_quick_edit'  => true,
          'show_in_rest'        => true,
      );

      register_taxonomy( 'review-category', 'reviews', $args );
  }
