2

私はwp3.5を使用しています。カスタム投稿が(sp_product)あり、カスタム分類法もあります。そのカスタム分類フィルター列を削除したいのですが、作成したくありません'show_admin_column' => false

から設定を解除したい$columns['']

どうすればいいですか?また、列とトップ選択メニューに表示されるときに、css/jsを追加したいと思います。(この画像のように表示されます)

ここに画像の説明を入力してください

4

1 に答える 1

2

カスタム投稿タイプ画面で列を非表示にするには、フィルターが必要ですmanage_{$this->screen->id}_columns

add_filter( 'manage_edit-sp_product_columns', 'hide_cpt_columns_so_14257172' );

function hide_cpt_columns_so_14257172( $columns )
{
    // Change categories for your custom taxonomy
    unset($columns['categories']);
    return $columns;
}

特定の画面にカスタムCSS/Javascriptを追加するには、アクションを使用できますadmin_head-$hook_suffix。次のコードは、、Show all datesおよびView all categories要素Filterを非表示にします。

add_action( 'admin_head-edit.php', 'custom_css_js_so_14257172' );

function custom_css_js_so_14257172() 
{
    // Apply only in the correct CPT, otherwise it would print in Pages/Posts
    global $current_screen;
    if( 'sp_product' != $current_screen->post_type)
        return;
    ?>
        <style>
            select[name="m"] { display:none }
            select[id="cat"] { display:none }
            #post-query-submit { display:none }
        </style>
    <?php
}
于 2013-03-10T14:45:46.290 に答える