在自定义帖子类型列表中显示自定义分类列
我创建了一个名为横幅的自定义帖子类型.因此,我注册了一个名为 location 的新分类法,用于指定要在哪个页面上显示横幅.一切都很好,但是当我在管理窗口中单击自定义帖子类型横幅"时,我看到了所有创建的横幅,但是表格中没有用于分类位置"的列.
I have created a custom post type named banners. Thereby I register a new taxonomy called location that specifies on which page the banner is to be shown. Everything is great however when I click on the custom posts type 'Banner' in the admin window I see all the banners created however the table does not have a column for the taxonomy 'Location'.
换句话说,我希望能够在横幅列表中看到横幅所在的位置.
In other words I want to be able to see what location the banner is in, in the banners listing.
对于那些感兴趣的人,register_taxonomy 函数,如WordPress 3.5 现在为 show_admin_column
提供一个参数(默认为 false).设置为 true
,它会自动在管理员中显示分类列.
For those interested, the register_taxonomy function, as of WordPress 3.5, now offers an argument for show_admin_column
(false by default). Set to true
, it automatically displays the taxonomy column in the admin.