File tree 1 file changed +24
-0
lines changed
pages/docs/ServicesProvider
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -56,3 +56,27 @@ Add this new Service Provider to the list of providers in the `config/plugin.php
56
56
57
57
'custom_taxonomy_types' => [ '\WPKirk\CustomTaxonomyTypes\MyCustomTaxonomy' ],
58
58
```
59
+
60
+ ## Columns
61
+ You may add columns to your Custom Taxonomy Type by adding the following code to your Service Provider:
62
+ ``` php filename="plugin/CustomTaxonomyTypes/MyCustomTaxonomy.php" copy
63
+ public function registerColumns()
64
+ {
65
+ return [
66
+ 'my_new_column_name' => 'Column Name',
67
+ ];
68
+ }
69
+ ```
70
+
71
+ and also set the Column Content (where you can process the output), is * mandatory* to use ` return ` and not an ` echo ` statement
72
+
73
+ ``` php filename="plugin/CustomTaxonomyTypes/MyCustomTaxonomy.php" copy
74
+ public function columnContent($string, $column_name, $term_id)
75
+ {
76
+ if ($column_name === 'my_new_column_name') {
77
+ //... your logic here
78
+ return 'your_new_content_here';
79
+ }
80
+ return $string;
81
+ }
82
+ ```
You can’t perform that action at this time.
0 commit comments