How to display "accept reject" buttons using custom post type wordpress

Viewed 25

I am new in wordpress,In my admin panel,Admin can create "new project" ( create custom post) And i want this "project name" should be display in "user/subscripber" panel with "Accep Reject" buttons How can i do this ? For example in database whenever "Admin" creates new project then new entry saved in database "wp_postmeta"

meta_id             post_id             meta_key            meta_value
1                       26              project_status      sent

Now i want in my user panel, This project details should display,How can i do this ? Here is my existing code in functions.php

function create_posttype() {
  
    register_post_type( 'UserProject',
       array(
            'labels' => array(
                'name' => __( 'UserProject' ),
                'singular_name' => __( 'UserProject' )
            ),
            'capability_type' => 'UserProject',
            'capabilities' => array(
                'publish_posts' => 'publish_UserProject',
                'edit_posts' => 'edit_UserProject',
                'edit_others_posts' => 'edit_others_UserProject',
                'read_private_posts' => 'read_private_UserProject',
                'edit_post' => 'edit_UserProject',
                'delete_post' => 'delete_UserProject',
                'read_post' => 'read_UserProject',
            ),
            'public' => true,
            'has_archive' => true,
            'show_in_admin_bar'   => false,
            'show_in_menu' => true,
            'public' => true,
            'rewrite' => array('slug' => 'UserProject'),
            'show_in_rest' => true,
            'menu_position' => 21
  
        )
    );
}
add_action( 'init', 'create_posttype' );

function add_capability()
{
    $role = get_role('subscriber');
    $role->add_cap('read_UserProject');
    $role->add_cap('edit_UserProject');
    $role->add_cap('delete_UserProject'); // to be sure
}
add_action('admin_init', 'add_capability');
0 Answers
Related