14/10
2013
Wallogit.com
2017 © Pedro Peláez
Create post type columns with ease.
To create custom coluns in Wordpress is quite a pain. We build a simple API around the wordpress functions to easily create, delete, rename and make columns sortable., (*1)
Columns is installable through Composer., (*2)
require {
"devdk/columns": "dev-master"
}
use Devdk\Columns;
Columns::make($post_type, function($col)
{
$col->column("Column Title")->content( function ($post, $meta) {
return $meta["key"][0];
});
});
use Devdk\Columns;
Columns::make($post_type, function ($col) {
$col->column("Column Title")->content(function($post, $meta){
return $meta["key"][0];
})->before("date")->sortable("meta_key");
});
use Devdk\Columns;
Columns::make($post_type, function ($col) {
$col->column("Column Title")->content(function($post, $meta){
return $meta["key"][0];
})->after("title")->sortable("meta_key");
});