You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.9 KiB

<?php
/**
* FAQ Custom Post Type Registration
*/
if (!defined('ABSPATH')) {
exit;
}
function nenghui_register_faq_cpt() {
$labels = array(
'name' => _x('FAQs', 'Post Type General Name', 'nenghui'),
'singular_name' => _x('FAQ', 'Post Type Singular Name', 'nenghui'),
'menu_name' => __('FAQs', 'nenghui'),
'name_admin_bar' => __('FAQ', 'nenghui'),
'archives' => __('FAQ Archives', 'nenghui'),
'attributes' => __('FAQ Attributes', 'nenghui'),
'parent_item_colon' => __('Parent FAQ:', 'nenghui'),
'all_items' => __('All FAQs', 'nenghui'),
'add_new_item' => __('Add New FAQ', 'nenghui'),
'add_new' => __('Add New', 'nenghui'),
'new_item' => __('New FAQ', 'nenghui'),
'edit_item' => __('Edit FAQ', 'nenghui'),
'update_item' => __('Update FAQ', 'nenghui'),
'view_item' => __('View FAQ', 'nenghui'),
'view_items' => __('View FAQs', 'nenghui'),
'search_items' => __('Search FAQ', 'nenghui'),
'not_found' => __('Not found', 'nenghui'),
'not_found_in_trash' => __('Not found in Trash', 'nenghui'),
'featured_image' => __('Featured Image', 'nenghui'),
'set_featured_image' => __('Set featured image', 'nenghui'),
'remove_featured_image' => __('Remove featured image', 'nenghui'),
'use_featured_image' => __('Use as featured image', 'nenghui'),
'insert_into_item' => __('Insert into FAQ', 'nenghui'),
'uploaded_to_this_item' => __('Uploaded to this FAQ', 'nenghui'),
'items_list' => __('FAQs list', 'nenghui'),
'items_list_navigation' => __('FAQs list navigation', 'nenghui'),
'filter_items_list' => __('Filter FAQs list', 'nenghui'),
);
$args = array(
'label' => __('FAQ', 'nenghui'),
'description' => __('Frequently Asked Questions', 'nenghui'),
'labels' => $labels,
'supports' => array('title', 'editor', 'page-attributes'), // page-attributes for menu_order
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 20,
'menu_icon' => 'dashicons-format-chat',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
'show_in_rest' => true, // Enable Gutenberg editor
);
register_post_type('faq', $args);
}
add_action('init', 'nenghui_register_faq_cpt');