customization – Custom Post Achieve Page not working

Question

add_action(‘init’, function() {
register_post_type(‘vendorpost’, [
‘label’ => __(‘Vendor Post’, ‘txtdomain’),
‘public’ => true,
‘menu_position’ => 5,
‘menu_icon’ => ‘dashicons-admin-users’,
‘supports’ => [‘title’, ‘editor’, ‘thumbnail’, ‘tag’, ‘revisions’, ‘comments’],
‘show_in_rest’ => true,
‘rewrite’ => [‘slug’ => ‘vendorposts’],
‘taxonomies’ => [‘vendorpost_author’, ‘vendorpost_genre’],
‘labels’ => [
‘singular_name’ => __(‘Vendor Post’, ‘txtdomain’),
‘add_new_item’ => __(‘Add new vendor post’, ‘txtdomain’),
‘new_item’ => __(‘New Vendor Post’, ‘txtdomain’),
‘view_item’ => __(‘View Vendor Post’, ‘txtdomain’),
‘not_found’ => __(‘No Vendor Post found’, ‘txtdomain’),
‘not_found_in_trash’ => __(‘No Vendor Post found in trash’, ‘txtdomain’),
‘all_items’ => __(‘All Vendor Post’, ‘txtdomain’),
‘insert_into_item’ => __(‘Insert into Vendor Post’, ‘txtdomain’)
],
]);

register_taxonomy('vendorpost_category', ['vendorpost'], [
    'label' => __('Categories', 'txtdomain'),
    'hierarchical' => true,
    'rewrite' => ['slug' => 'vendorposts-category'],
    'show_admin_column' => true,
    'show_in_rest' => true,
    'labels' => [
        'singular_name' => __('Category', 'txtdomain'),
        'all_items' => __('All Category', 'txtdomain'),
        'edit_item' => __('Edit Category', 'txtdomain'),
        'view_item' => __('View Category', 'txtdomain'),
        'update_item' => __('Update Category', 'txtdomain'),
        'add_new_item' => __('Add New Category', 'txtdomain'),
        'new_item_name' => __('New Category Name', 'txtdomain'),
        'search_items' => __('Search Categorys', 'txtdomain'),
        'parent_item' => __('Parent Category', 'txtdomain'),
        'parent_item_colon' => __('Parent Category:', 'txtdomain'),
        'not_found' => __('No Category found', 'txtdomain'),
    ]
]);
register_taxonomy_for_object_type('vendorpost_category', 'vendorpost');

register_taxonomy('vendorpost_tag', ['vendorpost'], [
    'label' => __('Tags', 'txtdomain'),
    'hierarchical' => false,
    'rewrite' => ['slug' => 'vendorposts-tag'],
    'show_admin_column' => true,
    'labels' => [
        'singular_name' => __('Tag', 'txtdomain'),
        'all_items' => __('All Tags', 'txtdomain'),
        'edit_item' => __('Edit Tag', 'txtdomain'),
        'view_item' => __('View Tag', 'txtdomain'),
        'update_item' => __('Update Tag', 'txtdomain'),
        'add_new_item' => __('Add New Tag', 'txtdomain'),
        'new_item_name' => __('New Tag Name', 'txtdomain'),
        'search_items' => __('Search Tags', 'txtdomain'),
        'popular_items' => __('Popular Tags', 'txtdomain'),
        'separate_items_with_commas' => __('Separate Tags with comma', 'txtdomain'),
        'choose_from_most_used' => __('Choose from most used Tags', 'txtdomain'),
        'not_found' => __('No Tags found', 'txtdomain'),
    ]
]);
register_taxonomy_for_object_type('vendorpost_tag', 'vendorpost');

});

0
Lokesh8285 1 year 2022-02-19T05:36:30-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse