admin管理员组文章数量:1129020
In my custom post type I unset the title column to add onclick
event on each post title but it shift's the check boxes to next column, how can I have back check boxes to the title or if I want to hide completely how can I do that.
First i remove all row actions
add_filter('post_row_actions', 'remove_row_actions', 10, 1);
function remove_row_actions($actions) {
if (get_post_type() === 'tasks') {
unset($actions['edit']);
unset($actions['view']);
unset($actions['trash']);
unset($actions['inline hide-if-no-js']);
}
return $actions;
}
then I unset and re produce the title column
add_filter('manage_edit-tasks_columns', 'edit_first_column');
function edit_first_column($columns) {
unset($columns['title']);
$arr = array();
foreach ($columns as $key => $value) {
$arr['new_title'] = 'Title';
$arr[$key] = $value;
}
return $arr;
}
In my custom post type I unset the title column to add onclick
event on each post title but it shift's the check boxes to next column, how can I have back check boxes to the title or if I want to hide completely how can I do that.
http://prntscr.com/gv5odl
First i remove all row actions
add_filter('post_row_actions', 'remove_row_actions', 10, 1);
function remove_row_actions($actions) {
if (get_post_type() === 'tasks') {
unset($actions['edit']);
unset($actions['view']);
unset($actions['trash']);
unset($actions['inline hide-if-no-js']);
}
return $actions;
}
then I unset and re produce the title column
add_filter('manage_edit-tasks_columns', 'edit_first_column');
function edit_first_column($columns) {
unset($columns['title']);
$arr = array();
foreach ($columns as $key => $value) {
$arr['new_title'] = 'Title';
$arr[$key] = $value;
}
return $arr;
}
Share
Improve this question
edited Oct 9, 2017 at 16:48
mmm
3,8083 gold badges16 silver badges22 bronze badges
asked Oct 9, 2017 at 12:47
mohsinmohsin
1772 silver badges9 bronze badges
1 Answer
Reset to default 1look what is in $columns
, you will see the column cb
for "checkbox"
then you can do that :
function edit_first_column($columns) {
$arr = [
"cb" => $columns["cb"];
"new_title" = "Title";
]
unset($columns['cb']);
unset($columns['title']);
$arr += $columns;
return $arr;
}
本文标签: plugin developmentHow to enable or disable check boxes in custom post type
版权声明:本文标题:plugin development - How to enable or disable check boxes in custom post type 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736717167a1949261.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论