2

so... this is a brand new chapter for me, i've googled for a solution and found loads but nothing working for me unfortunately.

        function column_title($item){

  $actions = array(
            'edit'      => sprintf('<a href="?page=%s&action=%s&ID=%s">Edit</a>',$_REQUEST['page'],'edit',$item['ID']),
            'delete'    => sprintf('<a href="?page=%s&action=%s&ID=%s">Delete</a>',$_REQUEST['page'],'delete',$item['ID']),
        );

  return sprintf('%1$s %2$s', $item['ID'], $this->row_actions($actions) );
}

above i've added a delete and edit action, and i think i've used the sprintf the proper way but i'm not sure, database table contains the following columns ID, usr_id, date, begin, end, pause, egenb, tot, and asum i want my actions to select the rows by ID so is my code above correct?

 function column_cb($item) {
    return sprintf(
        '<input type="checkbox" name="ID[]" value="%s" />', $item['ID']
    );    
}

above is my check box, normally name="book[]" can someone explain what the purpose of the [] is?

    function process_bulk_action() {

    //Detect when a bulk action is being triggered...
    if( 'delete'===$this->current_action() ) {
        wp_die('Items deleted (or they would be if we had items to delete)!');
    }   
}

and last we got process_bulk_action where the delete action and edit action is to take place is there a kind person out there that can explain how i would go about this? i'm not just seeking a quick answer but understanding of it, i've tried with loads of things i found thru google but none made the slightest effect nor did it make any sense to me

in advance thanks to anyone taking the time to read thru my post! :)

  • Did you find a solution to this how you can delete a row? – CompactCode May 3 '17 at 8:59
0

above is my check box, normally name="book[]" can someone explain what the purpose of the [] is?

This is allowing the checked values to be returned as an array when getting the results, if you have more than one value checked.

Besides that, I can't tell what you're trying to do in order to be able to answer the other questions. Especially the last part. It appears like you're asking someone to write the code for you, for process_bulk_action()? There's not enough specific question to answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.