0

I have my CPT edit screen almost looking how I want it but want to remove the filter and view options from this screen as they are not needed for this interface. How do I remove them? Are there any filters that disable them?

How my CPT edit screen looks now

My edit screen has got to this stage by this code so far:

// Manage columns in edit screen
add_filter('manage_edit-staff_columns', 'sc_staff_modify_columns');
function sc_staff_modify_columns($staff_columns) {
    $staff_columns['title'] = __('Staff Name', 'sc_wilsons_custom');
    $staff_columns['job_role'] = __('Job Role', 'sc_wilsons_custom');
    $staff_columns['is_store_manager'] = __('Store Manager', 'sc_wilsons_custom');
    $staff_columns['located'] = __('Located At', 'sc_wilsons_custom');
    unset($staff_columns['date']);
    return $staff_columns;
}
add_action('manage_staff_posts_custom_column', 'sc_staff_manage_columns', 10, 2);
function sc_staff_manage_columns($column_name, $id) {
    global $wpdb;
    $custom = get_post_custom($id);
    switch ($column_name) {
        case 'job_role':
            echo $custom["sc_staff_job_role"][0];
        break;

        case 'is_store_manager':
            echo ($custom["sc_staff_store_manager"][0] == 1) ? __('Yes', 'sc_wilsons_custom') : __('No', 'sc_wilsons_custom');
        break;

        case 'located':
            if(is_int($custom["sc_staff_located"][0])){
                $post = get_post($custom["sc_staff_located"][0]);
                echo $post->post_title;
            } else {
                _e('Unknown', 'sc_wilsons_custom');
            }
        break;
    }
}

EDIT: if it helps I have found where the code for these bits are generated. Functions months_dropdown() and view_switcher in file /wp-admin/includes/class-wp-list-table.php

I don't see any filters or hooks here so might be out of luck. Anyway of doing this by extending the WP_List_Table class?

1

Css:

.tablenav.top .alignleft.actions select[name="m"],
.tablenav.top .alignleft.actions select#cat,
.tablenav.top .alignleft.actions input#post-query-submit,
.tablenav.top .view-switch { 
    display: none; 
}

Note: You'll have to take a look at the input elements ID. I guess this will be named different on custom post types.

  • Sorry kaiser I cannot see any element ID's that have my post type in that I can capture these elements just on this CPT. – Brady May 26 '11 at 18:31
  • 2
    @Brady check post_type in GET and conditionally insert the css if it matches. – Milo May 26 '11 at 18:46
  • @Milo - Messy but ok I'll look into – Brady May 26 '11 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.