Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

FAQS

if ( ! function_exists('create_faq') ) {

// Register Custom Post Type
function create_faq() {

	$labels = array(
		'name'                => _x( 'FAQS', 'Post Type General Name', 'faq' ),
		'singular_name'       => _x( 'FAQ', 'Post Type Singular Name', 'faq' ),
		'menu_name'           => __( 'FAQS', 'faq' ),
		'name_admin_bar'      => __( 'FAQS', 'faq' ),
		'parent_item_colon'   => __( 'Parent Item:', 'faq' ),
		'all_items'           => __( 'All Items', 'faq' ),
		'add_new_item'        => __( 'Add New Item', 'faq' ),
		'add_new'             => __( 'Add New', 'faq' ),
		'new_item'            => __( 'New Item', 'faq' ),
		'edit_item'           => __( 'Edit Item', 'faq' ),
		'update_item'         => __( 'Update Item', 'faq' ),
		'view_item'           => __( 'View Item', 'faq' ),
		'search_items'        => __( 'Search Item', 'faq' ),
		'not_found'           => __( 'Not found', 'faq' ),
		'not_found_in_trash'  => __( 'Not found in Trash', 'faq' ),
	);
	$rewrite = array(
		'slug'                => 'faq',
		'with_front'          => true,
		'pages'               => true,
		'feeds'               => true,
	);
	$capabilities = array(
		'edit_post'           => 'edit_post',
		'read_post'           => 'read_post',
		'delete_post'         => 'delete_post',
		'edit_posts'          => 'edit_posts',
		'edit_others_posts'   => 'edit_others_posts',
		'publish_posts'       => 'publish_posts',
		'read_private_posts'  => 'read_private_posts',
	);
	$args = array(
		'label'               => __( 'faq', 'faq' ),
		'description'         => __( 'FAQS Page', 'faq' ),
		'labels'              => $labels,
		'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes', 'post-formats', ),
		'taxonomies'          => array( 'faq-category' ),
		'hierarchical'        => true,
		'public'              => true,
		'show_ui'             => true,
		'show_in_menu'        => true,
		'menu_position'       => 5,
		'menu_icon'           => 'dashicons-admin-home',
		'show_in_admin_bar'   => true,
		'show_in_nav_menus'   => true,
		'can_export'          => true,
		'has_archive'         => true,
		'exclude_from_search' => false,
		'publicly_queryable'  => true,
		'rewrite'             => $rewrite,
		'capabilities'        => $capabilities,
	);
	register_post_type( 'faq', $args );

}

// Hook into the 'init' action
add_action( 'init', 'create_faq', 0 );

}