How to add FAQ system in WordPress using Custom Post Type?

How to add FAQ system in WordPress using Custom Post Type?

1 thought on “How to add FAQ system in WordPress using Custom Post Type?”

  1. Add the below code in functions.php file of your theme folder.

    /*** Register FAQ post type. ***/

    add_action( ‘init’, ‘faqs’ );

    function faqs()

    {

    register_taxonomy(‘faqs’, ‘faqs’, array(

    ‘hierarchical’ => true,

    ‘labels’ => array(

    ‘name’ => _x( ‘FAQ Category’, ‘taxonomy general name’ ),

    ‘singular_name’ => _x( ‘faqs-Category’, ‘FAQ Category’ ),

    ‘search_items’ => __( ‘Search Car Categories’ ),

    ‘all_items’ => __( ‘All FAQ Categories’ ),

    ‘parent_item’ => __( ‘Parent FAQ Category’ ),

    ‘parent_item_colon’ => __( ‘Parent FAQ Category:’ ),

    ‘edit_item’ => __( ‘Edit FAQ Category’ ),

    ‘update_item’ => __( ‘Update FAQ Category’ ),

    ‘add_new_item’ => __( ‘Add New FAQ Category’ ),

    ‘new_item_name’ => __( ‘New FAQ Category Name’ ),

    ‘menu_name’ => __( ‘Categories’ ),

    ),

    ‘rewrite’ => array(

    ‘slug’ => ‘faqs’,

    ‘with_front’ => false,

    ‘hierarchical’ => true

    ),

    ));

    $labels = array(

    ‘name’ => _x( ‘FAQ ‘, ‘post type general name’, ‘textdomain’ ),

    ‘singular_name’ => _x( ‘FAQ ‘, ‘post type singular name’, ‘textdomain’ ),

    ‘menu_name’ => _x( ‘FAQ ‘, ‘admin menu’, ‘textdomain’ ),

    ‘name_admin_bar’ => _x( ‘FAQ ‘, ‘add new on admin bar’, ‘textdomain’ ),

    ‘add_new’ => _x( ‘Add New’, ‘FAQ’, ‘textdomain’ ),

    ‘add_new_item’ => __( ‘Add New FAQ’, ‘textdomain’ ), ‘new_item’ => __( ‘New FAQ’, ‘textdomain’ ), ‘edit_item’ => __( ‘Edit FAQ’, ‘textdomain’ ), ‘view_item’ => __( ‘View FAQ’, ‘textdomain’ ), ‘all_items’ => __( ‘All FAQ’, ‘textdomain’ ), ‘search_items’ => __( ‘Search FAQ’, ‘textdomain’ ), ‘parent_item_colon’ => __( ‘Parent FAQ:’, ‘textdomain’ ), ‘not_found’ => __( ‘No FAQ found.’, ‘textdomain’ ), ‘not_found_in_trash’ => __( ‘No FAQ found in Trash.’, ‘textdomain’ ) );

    $args = array(

    ‘labels’ => $labels,

    ‘public’ => true,

    ‘publicly_queryable’ => true,

    ‘show_ui’ => true,

    ‘show_in_menu’ => true,

    ‘query_var’ => true,

    ‘rewrite’ => array( ‘slug’ => ‘faqs’),

    ‘capability_type’ => ‘post’,

    ‘has_archive’ => true,

    ‘hierarchical’ => false,

    ‘menu_position’ => 6,

    ‘supports’ => array( ‘title’, ‘editor’, ‘author’, ‘thumbnail’, ‘excerpt’, ‘comments’,’custom-fields’ ),

    );

    register_post_type( ‘faqs’, $args );

    }

  2. Reply

Leave a Comment

izmir eskort - mersin eskort bayan - adana eskort - antalya eskort - eskort istanbul