Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In my plugin which shows a table of business listings from database, I wanted to add the option for bulk actions. Besides the checkboxes I displayed the control for bulk actions, but when I click Apply, nothing happens. How do I perform a bulk edit, delete anyway, since I've no idea if I'm even on the right track.

this is my Listing table class constructor

function __construct() {
     parent::__construct( array(
    'singular'=> 'wp_list_text_link', //Singular label
    'plural' => 'wp_list_test_links', //plural label, also this well be one of the table css class
    'ajax'  => false //We won't support Ajax for this table
    ) );
 }

and display row function function display_rows() {

//Get the records registered in the prepare_items method
$records = $this->items;
      list( $columns, $hidden ) = $this->get_column_info();

      //print_r($records);
//Loop for each record
if(!empty($records)){foreach($records as $rec){

    //Open the line
    echo '<tr id="record_'.$rec->sr_no.'">';
    foreach ( $columns as $column_name => $column_display_name ) {

        //Style attributes for each col
        $class = "class='$column_name column-$column_name'";
        $style = "";
        if ( in_array( $column_name, $hidden ) ) $style = ' style="display:none;"';
        $attributes = $class . $style;

        //edit link



        //Display the cell
        switch ( $column_name ) {
                case "name": 
                                echo '<td '.$attributes.'>'.stripslashes($rec->name);
                                   $actions = $this->get_bulk_actions();




            echo $this->row_actions( $actions );

            echo '</td>';
        break;


            case "cb": echo '<td '.$attributes.'><input type="checkbox" name="wp_list_text_link[]" value="%s"></td>'; break;
            case "name": echo '<td '.$attributes.'>'.stripslashes($rec->name).'</td>'; break;
            case "address": echo '<td '.$attributes.'>'.$rec->address.'</td>'; break;
            case "phone": echo '<td '.$attributes.'>'.$rec->phone.'</td>'; break;
                            case "datestarted": echo '<td '.$attributes.'>'.$rec->start_date.'</td>'; break;
            case "url": echo '<td '.$attributes.'>'.$rec->url.'</td>'; break;
        }
    }

    //Close the line
    echo'</tr>';
}}
}

so how bulk actions will be implemented in this code. get_bulk_actions()?

share|improve this question
    
Please show what you've done so far, so that one can understand what actually isn't working with your approach. Additionally you might want to take a look at How to Ask and the site help center in general. –  ialocin Jan 9 at 14:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.