themeplate/column

ThemePlate custom admin columns

v2.1.0 2023-03-05 11:40 UTC

This package is auto-updated.

Last update: 2024-11-05 15:26:46 UTC


README

Usage

use ThemePlate\Column\PostTypeColumn;
use ThemePlate\Column\TaxonomyColumn;
use ThemePlate\Column\UsersColumn;

function pretty_print( $object_id ) {
	echo '&hearts;&nbsp;<b>' . $object_id . '</b> &mdash;&rsaquo;';
};

( new PostTypeColumn( 'Post ID', 'pretty_print' ) )->init();
( new TaxonomyColumn( 'Term ID', 'pretty_print' ) )->init();
( new UsersColumn( 'User ID', 'pretty_print' ) )->init();

Available config

// Before init
$column->position( 0 )->args( array() )->class( '' );

Specific location

( new PostTypeColumn( 'Model', $my_callback ) )->location( 'custom_post_type' )->init();
( new TaxonomyColumn( 'Value', $my_callback ) )->location( 'tax_1' )->location( 'tax_2' )->init();