-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathac-column-template.php
executable file
·59 lines (48 loc) · 1.77 KB
/
ac-column-template.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Plugin Name: Admin Columns - COLUMN_LABEL
* Plugin URI: https://admincolumns.com
* Description: COLUMN_LABEL column for Admin Columns Pro
* Version: 1.0
* Requires PHP: 7.2
*/
const AC_CT_FILE = __FILE__;
// 1. Register column type
add_action('acp/column_types', static function (AC\ListScreen $list_screen): void {
// Check for version requirement
if (ACP()->get_version()->is_lte(new AC\Plugin\Version('6.3'))) {
return;
}
// Load necessary files
require_once __DIR__ . '/classes/Column/Column.php';
require_once __DIR__ . '/classes/Column/Editing.php';
require_once __DIR__ . '/classes/Column/Export.php';
require_once __DIR__ . '/classes/Column/Search.php';
require_once __DIR__ . '/classes/Column/Sorting.php';
// Make your custom column available to a specific WordPress list table:
// Example #1 - for the custom post type 'page'
if ('page' === $list_screen->get_key()) {
// Register column
$list_screen->register_column_type(
new AcColumnTemplate\Column\Column()
);
}
// Example #2 - for media
// if ( 'attachment' === $list_screen->get_key() ) {
// Register column
// }
// Example #3 - for all post types
// if ( AC\MetaType::POST === $list_screen->get_meta_type() ) {
// Register column
// }
// Example #4 - for users
// if ( AC\MetaType::USER === $list_screen->get_meta_type() ) {
// Register column
// }
// Example #4 - for categories on the taxonomy list table
// if ( $list_screen instanceof ACP\ListScreen\Taxonomy && 'category' === $list_screen->get_taxonomy()) {
// Register column
// }
});
// 2. Optionally: load a text domain
// load_plugin_textdomain('ac-column-template', false, __DIR__ . '/languages/');