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 | |
... | |
/** | |
* Column cb. | |
* | |
* @param array $item Item data. | |
* @return string | |
*/ | |
public function column_cb( $item ) { | |
return sprintf( |
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 | |
... | |
/** | |
* Return title column. | |
* | |
* @param array $item Item data. | |
* @return string | |
*/ | |
public function column_title( $item ) { | |
$edit_url = get_edit_post_link( $item['id'] ); |
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 list columns. | |
* | |
* @return array | |
*/ | |
public function get_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 | |
... | |
/** | |
* The Default columns | |
* | |
* @param array $item The Item being displayed. | |
* @param string $column_name The column we're currently in. | |
* @return string The Content to display | |
*/ | |
public function column_default( $item, $column_name ) { |
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 | |
... | |
/** | |
* Display text for when there are no items. | |
*/ | |
public function no_items() { | |
esc_html_e( 'No posts found.', '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 | |
... | |
/** | |
* Return instances post object. | |
* | |
* @return WP_Query Custom query object with passed arguments. | |
*/ | |
protected function get_posts_object() { | |
$post_types = $this->allowed_post_types; |
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 | |
... | |
/** | |
* A map method return all allowed post types to human readable format. | |
* | |
* @return array Array of allowed post types in human readable format. | |
*/ | |
private function allowed_post_types_readable() { | |
$formatted = array_map( | |
array( $this, 'human_readable' ), |
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 | |
... | |
/** | |
* Convert slug string to human readable. | |
* | |
* @param string $title String to transform human readable. | |
* | |
* @return string Human readable of the input string. | |
*/ |
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 | |
... | |
/** | |
* Retrieve post types to be shown in the table. | |
* | |
* @return array Allowed post types in an array. | |
*/ | |
private function allowed_post_types() { | |
$post_types = get_post_types( array( 'public' => true ) ); | |
unset( $post_types['attachment'] ); |
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 | |
... | |
/** | |
* Draft_List_Table constructor. | |
*/ | |
public function __construct() { | |
parent::__construct( | |
array( | |
'singular' => 'Draft', |