_x( 'Reviews', 'post type general name', 'amz-plugin' ), 'singular_name' => _x( 'Review', 'post type singular name', 'amz-plugin' ), 'menu_name' => _x( 'Reviews', 'admin menu', 'amz-plugin' ), 'name_admin_bar' => _x( 'Review', 'add new on admin bar', 'amz-plugin' ), 'add_new' => _x( 'Add New', 'review', 'amz-plugin' ), 'add_new_item' => __( 'Add New Review', 'amz-plugin' ), 'new_item' => __( 'New Review', 'amz-plugin' ), 'edit_item' => __( 'Edit Review', 'amz-plugin' ), 'view_item' => __( 'View Review', 'amz-plugin' ), 'all_items' => __( 'All Reviews', 'amz-plugin' ), 'search_items' => __( 'Search Reviews', 'amz-plugin' ), 'parent_item_colon' => __( 'Parent Reviews:', 'amz-plugin' ), 'not_found' => __( 'No reviews found.', 'amz-plugin' ), 'not_found_in_trash' => __( 'No reviews found in Trash.', 'amz-plugin' ) ); $args = array( 'labels' => $labels, 'description' => __( 'Description.', 'amz-plugin' ), 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'reviews' ), 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => 5, 'taxonomies' => array('category', 'post_tag'), 'supports' => array('title', 'editor', 'author', 'comments', 'revisions', 'thumbnail'), 'menu_icon' => 'dashicons-star-filled' ); if (!post_type_exists('reviews')) { register_post_type( 'reviews', $args ); add_action('init', 'amz_reviews_add_default_boxes'); function amz_reviews_add_default_boxes() { register_taxonomy_for_object_type('category', 'reviews'); register_taxonomy_for_object_type('post_tag', 'reviews'); } } if (post_type_exists('reviews')) { register_post_type( 'reviews', $args ); require_once('reviewcustomfields.php'); } } /** * Include CSS file for MyPlugin. */ function amz_plugin_scripts() { wp_register_style( 'amz-styles', plugin_dir_url( __FILE__ ) . 'style.css' ); wp_enqueue_style( 'amz-styles' ); } add_action( 'wp_enqueue_scripts', 'amz_plugin_scripts' ); // Recent Reviews Sidebar Widget function amz_widget_reviews_display($args) { echo $args['before_widget']; echo $args['before_title'] . 'Recent Reviews' . $args['after_title']; ?>