• Resolved ztvmark

    (@ztvmark)


    Blocksy does not recognize post type lessons

    I have created some post types and they appear in the editor
    But the only post types that he doesn’t recognize are the lesson type ones

    As you can see in the image, the other post types appear, but the lesson type ones do not appear, even I used a clean WordPress installation

    Here is the code I use to create tools and lessons, they are the same, but lesson does not work in the customize section
    However, I can create a lesson type post

    //post_type_tool
    add_action( 'init', 'post_type_tool' );
    function post_type_tool() {
    	$args = [
    		'label'  => esc_html__( 'Tools', 'my_site' ),
    		'labels' => [
    			'menu_name'          => esc_html__( 'Tools', 'my_site' ),
    			'name_admin_bar'     => esc_html__( 'Tool', 'my_site' ),
    			'add_new'            => esc_html__( 'Add Tool', 'my_site' ),
    			'add_new_item'       => esc_html__( 'Add new Tool', 'my_site' ),
    			'new_item'           => esc_html__( 'New Tool', 'my_site' ),
    			'edit_item'          => esc_html__( 'Edit Tool', 'my_site' ),
    			'view_item'          => esc_html__( 'View Tool', 'my_site' ),
    			'update_item'        => esc_html__( 'View Tool', 'my_site' ),
    			'all_items'          => esc_html__( 'All Tools', 'my_site' ),
    			'search_items'       => esc_html__( 'Search Tools', 'my_site' ),
    			'parent_item_colon'  => esc_html__( 'Parent Tool', 'my_site' ),
    			'not_found'          => esc_html__( 'No Tools found', 'my_site' ),
    			'not_found_in_trash' => esc_html__( 'No Tools found in Trash', 'my_site' ),
    			'name'               => esc_html__( 'Tools', 'my_site' ),
    			'singular_name'      => esc_html__( 'Tool', 'my_site' ),
    		],
    		'public'              => true,
    		'exclude_from_search' => false,
    		'publicly_queryable'  => true,
    		'show_ui'             => true,
    		'show_in_nav_menus'   => true,
    		'show_in_admin_bar'   => true,
    		'show_in_rest'        => true,
    		'capability_type'     => 'post',
    		'hierarchical'        => false,
    		'has_archive'         => true,
    		'query_var'           => true,
    		'can_export'          => true,
    		'rewrite_no_front'    => false,
    		'show_in_menu'        => true,
    		'menu_icon'           => 'dashicons-book-alt',
    		'menu_position'         => 5,
    		'supports' => [
    			'title',
    			'editor',
    			'thumbnail',
    		],
    		'taxonomies' => [
    			'category',
    			'post_tag',
    		],
    		'rewrite' => true
    	];
    
    	register_post_type( 'tool', $args );
    }
    // ./post_type_tool
    //post_type_lesson
    add_action( 'init', 'post_type_lesson' );
    function post_type_lesson() {
    	$args = [
    		'label'  => esc_html__( 'Lessons', 'my_site' ),
    		'labels' => [
    			'menu_name'          => esc_html__( 'Lessons', 'my_site' ),
    			'name_admin_bar'     => esc_html__( 'Lesson', 'my_site' ),
    			'add_new'            => esc_html__( 'Add Lesson', 'my_site' ),
    			'add_new_item'       => esc_html__( 'Add new Lesson', 'my_site' ),
    			'new_item'           => esc_html__( 'New Lesson', 'my_site' ),
    			'edit_item'          => esc_html__( 'Edit Lesson', 'my_site' ),
    			'view_item'          => esc_html__( 'View Lesson', 'my_site' ),
    			'update_item'        => esc_html__( 'View Lesson', 'my_site' ),
    			'all_items'          => esc_html__( 'All Lessons', 'my_site' ),
    			'search_items'       => esc_html__( 'Search Lessons', 'my_site' ),
    			'parent_item_colon'  => esc_html__( 'Parent Lesson', 'my_site' ),
    			'not_found'          => esc_html__( 'No Lessons found', 'my_site' ),
    			'not_found_in_trash' => esc_html__( 'No Lessons found in Trash', 'my_site' ),
    			'name'               => esc_html__( 'Lessons', 'my_site' ),
    			'singular_name'      => esc_html__( 'Lesson', 'my_site' ),
    		],
    		'public'              => true,
    		'exclude_from_search' => false,
    		'publicly_queryable'  => true,
    		'show_ui'             => true,
    		'show_in_nav_menus'   => true,
    		'show_in_admin_bar'   => true,
    		'show_in_rest'        => true,
    		'capability_type'     => 'post',
    		'hierarchical'        => false,
    		'has_archive'         => true,
    		'query_var'           => true,
    		'can_export'          => true,
    		'rewrite_no_front'    => false,
    		'show_in_menu'        => true,
    		'menu_icon'           => 'dashicons-book-alt',
    		'menu_position'         => 5,
    		'supports' => [
    			'title',
    			'editor',
    			'thumbnail',
    		],
    		'taxonomies' => [
    			'category',
    			'post_tag',
    		],
    		'rewrite' => true
    	];
    
    	register_post_type( 'lesson', $args );
    }
    // ./post_type_lesson
Viewing 1 replies (of 1 total)
  • Hello @ztvmark

    That would actually be correct, as we reserve some specific CPT names for our integrations with various plugins. In this case, “lesson” is reserved for the LMS kind of plugins.

    The recommended thing to do here would be to create a more unique name for this CPT, as bringing it back can cause conflicts in the future.

    Though, if you really wish to bring it back, you can use a little PHP snippet –

    add_filter('blocksy:custom_post_types:supported_list', function ($cpts) {
        $cpts[] = 'lesson';
    
        return $cpts;
    });

    Hope this clears things up!

    Thanks.

Viewing 1 replies (of 1 total)
  • The topic ‘Blocksy does not recognize post type lessons’ is closed to new replies.