在 wordpress 后端添加额外的字段类型
Add extra field type in wordpress back end
read mark places i want to add extra two fields. that is Liked and Unliked
我该怎么做?
我的寄存器 post 类型是:
`register_post_type('faq-page', 数组(
'labels' => array(
'name' => 'FAQ',
'add_new_item' => 'Add New FAQ',
'add_new' => 'Add New FAQ',
'all_items' => 'All FAQ',
),
'public' => true,
'show_in_rest' => true,
'supports' => array('title','editor'),
'menu_icon' => 'dashicons-plus',
));`
您需要使用 manage_[post_type]_posts_columns 挂钩。查看 WP 文档 - https://developer.wordpress.org/reference/hooks/manage_post_type_posts_columns/ . Also take a look at this article where you can get a good example on how to use this hook for custom post types - https://www.smashingmagazine.com/2017/12/customizing-admin-columns-wordpress/ 我认为这正是您所需要的。
read mark places i want to add extra two fields. that is Liked and Unliked 我该怎么做?
我的寄存器 post 类型是:
`register_post_type('faq-page', 数组(
'labels' => array(
'name' => 'FAQ',
'add_new_item' => 'Add New FAQ',
'add_new' => 'Add New FAQ',
'all_items' => 'All FAQ',
),
'public' => true,
'show_in_rest' => true,
'supports' => array('title','editor'),
'menu_icon' => 'dashicons-plus',
));`
您需要使用 manage_[post_type]_posts_columns 挂钩。查看 WP 文档 - https://developer.wordpress.org/reference/hooks/manage_post_type_posts_columns/ . Also take a look at this article where you can get a good example on how to use this hook for custom post types - https://www.smashingmagazine.com/2017/12/customizing-admin-columns-wordpress/ 我认为这正是您所需要的。