How to create Custom filter options in wp_list_table?

Code class Kv_subscribers_list extends WP_List_Table { function __construct(){ global $status, $page; parent::__construct( array( ‘singular’ => ‘notification’, ‘plural’ => ‘notifications’, ‘ajax’ => false ) ); } protected function get_views() { $status_links = array( “all” => __(“<a href=”#”>All</a>”,’my-plugin-slug’), “published” => __(“<a href=”#”>Published</a>”,’my-plugin-slug’), “trashed” => __(“<a href=”#”>Trashed</a>”,’my-plugin-slug’) ); return $status_links; } function column_default($item, $column_name){ switch($column_name){ case ’email’: case … Read more

How are bulk actions handled in custom list table classes?

Assuming you’re using the standard column_cb() function, the list table will pass the IDs of the selected rows in an array in $_GET, labeled as whatever you assigned to ‘singular’ in the list table’s constructor. Here’s a typical column_cb(): function column_cb($item){ return sprintf( ‘<input type=”checkbox” name=”%1$s[]” value=”%2$s” />’, /*$1%s*/ $this->_args[‘singular’], //Let’s simply repurpose the table’s … Read more

Custom columns for taxonomy list table

The manage_{TAXONOMY}_custom_column filter hook passes 3 arguments: $content $column_name $term_id So try this: function add_book_place_column_content($content,$column_name,$term_id){ $term= get_term($term_id, ‘book_place’); switch ($column_name) { case ‘foo’: //do your stuff here with $term or $term_id $content=”test”; break; default: break; } return $content; } add_filter(‘manage_book_place_custom_column’, ‘add_book_place_column_content’,10,3);

Change order of custom columns for edit panels

You are basically asking a PHP question, but I’ll answer it because it’s in the context of WordPress. You need to rebuild the columns array, inserting your column before the column you want it to be left of: add_filter(‘manage_posts_columns’, ‘thumbnail_column’); function thumbnail_column($columns) { $new = array(); foreach($columns as $key => $title) { if ($key==’author’) // … Read more