This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
/** | |
* This function is responsible for render the drafts table | |
*/ | |
function bootload_drafts_table() : void { | |
$drafts_table = new Drafts_List_Table(); | |
?> | |
<div class="wrap"> | |
<h2><?php esc_html_e( 'All Drafts List', 'admin-table-tut' ); ?></h2> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
/** | |
* Fires in head section of admin page | |
*/ | |
add_action( | |
'admin_head', | |
function() : void { | |
$page = esc_attr( filter_input( INPUT_GET, 'page' ) ); | |
if ( 'all-drafts' !== $page ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
/** | |
* Include the columns which can be sortable. | |
* | |
* @return Array $sortable_columns Return array of sortable columns. | |
*/ | |
public function get_sortable_columns() { | |
return array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
/** | |
* Navigation dropdown HTML generator | |
* | |
* @param array $args Argument array to generate dropdown. | |
* | |
* @return void | |
*/ | |
private function html_dropdown( $args ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
/** | |
* Get bulk actions. | |
* | |
* @return void | |
*/ | |
public function process_bulk_action() { | |
if ( 'trash' === $this->current_action() ) { | |
$post_ids = filter_input( INPUT_GET, 'draft_id', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
/** | |
* Get bulk actions. | |
* | |
* @return array | |
*/ | |
public function get_bulk_actions() { | |
return array( | |
'trash' => __( 'Move to Trash', 'admin-table-tut' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
/** | |
* Prepare the data for the WP List Table | |
* | |
* @return void | |
*/ | |
public function prepare_items() { | |
$columns = $this->get_columns(); | |
$sortable = $this->get_sortable_columns(); |
NewerOlder