Custom Post Types

[ad_1]

Hi,

I’ve used the functions.php to add two new post types to my site.

function nexus_post_types() {

// Teachers Post Type
register_post_type(‘teacher’, array(
‘supports’ => array(‘title’, ‘editor’, ‘thumbnail’, ‘excerpt’, ‘custom-fields’),
‘has_archive’ => true,
‘public’ => true,
‘show_in_rest’ => true,
‘labels’ => array(
‘name’ => ‘講師紹介’,
‘add_new_item’ => ‘Add New Teacher’,
‘edit_item’ => ‘Edit Teacher’,
‘all_items’ => ‘All Teachers’,
‘singular_name’ => ‘Teacher’
),
‘menu_icon’ => ‘dashicons-welcome-learn-more’
));

// Lessons Post Type
register_post_type(‘lesson’, array(
‘supports’ => array(‘title’, ‘editor’, ‘thumbnail’, ‘excerpt’, ‘custom-fields’),
‘rewrite’ => array(‘slug’ => ‘lessons’),
‘has_archive’ => true,
‘public’ => true,
‘show_in_rest’ => true,
‘labels’ => array(
‘name’ => ‘レッスン’,
‘add_new_item’ => ‘Add New Lesson’,
‘edit_item’ => ‘Edit Lesson’,
‘all_items’ => ‘All Lessons’,
‘singular_name’ => ‘Lesson’
),
‘menu_icon’ => ‘dashicons-book-alt’
));
}

add_action(‘init’, ‘nexus_post_types’);

For some reason, only one of them (the first one for “teacher” now shows in Blocksy for me to customise the archive page and the post cards. Why is is this and how to fix it? Any help would be appreciated.

[ad_2]
1 Comment
  1. I think one possible reason could be the ‘rewrite’ parameter you’ve set for the “lesson” post type. Try removing the ‘rewrite’ parameter and see if that helps.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer