Skip to content

WPBP/CPT_Columns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CPT Columns

License Downloads

Improve the CPT list in the backend for your CPTs

Install

composer require wpbp/cpt_columns:dev-master

composer-php52 supported.

Example

$post_columns = new CPT_columns( 'demo' );
$post_columns->add_column( 'cmb2_field', array(
    'label' => __( 'CMB2 Field' ),
    'type' => 'post_meta', //text, thumbnail, post_meta, author, custom_tax, custom_value
    'meta_key' => '_demo_meta_text',
    'orderby' => 'meta_value', // For WP-Query
    'sortable' => true,
    'prefix' => '<b>',
    'suffix' => '</b>',
    'def' => 'Not defined', // Default value in case post meta not found
    'order' => '-1' // This is the last column
	)
);