我是wordpress的新手。
我创建了三个“自定义帖子”类型,如
我使用以下代码在admin中创建自定义帖子类型。
function create_post_type_two_wheeler()
{
register_taxonomy_for_object_type('category', 'TwoWheeler'); // Register Taxonomies for Category
register_taxonomy_for_object_type('post_tag', 'TwoWheeler');
register_post_type('client', // Register Custom Post Type
array(
'labels' => array(
'name' => __('TwoWheeler', 'vehicles'), // Rename these to suit
'singular_name' => __('TwoWheeler', 'vehicles'),
'add_new' => __('Add New', 'vehicles'),
'add_new_item' => __('Add New TwoWheeler', 'vehicles'),
'edit' => __('Edit', 'vehicles'),
'edit_item' => __('Edit TwoWheeler', 'vehicles'),
'new_item' => __('New TwoWheeler', 'vehicles'),
'view' => __('View TwoWheeler', 'vehicles'),
'view_item' => __('View TwoWheeler', 'vehicles'),
'search_items' => __('Search TwoWheeler', 'vehicles'),
'not_found' => __('No TwoWheeler found', 'vehicles'),
'not_found_in_trash' => __('No TwoWheeler found in Trash', 'vehicles')
),
'public' => true,
'hierarchical' => true, // Allows your posts to behave like Hierarchy Pages
'has_archive' => true,
'supports' => array(
'title',
'editor',
'excerpt',
'thumbnail'
), // Go to Dashboard Custom HTML5 Blank post for supports
'can_export' => true, // Allows export in Tools > Export
'taxonomies' => array(
'post_tag',
'category'
) // Add Category and Post Tags support
));
}
add_action('init', 'create_post_type_two_wheeler');
现在我想显示管理员添加/编辑“两轮车”自定义帖子类型的帖子。用户可以为该特定帖子选择该选项并将该选项保存在数据库中。
任何有助于我这样做的谷歌链接? 我需要一种方法来开始这项工作。