Untitled

 avatar
unknown
plain_text
a year ago
1.2 kB
5
Indexable
add_action('init', function () {
    register_post_type(
        self::POST_TYPE_ROOM, // Make sure this constant is correctly defined
        array(
            'labels'             => array(
                'name'          => __('Rooms'),
                'singular_name' => __('Room'),
            ),
            'supports'           => array('title', 'thumbnail', 'editor'),
            'public'             => true,
            'publicly_queryable' => true,
            'has_archive'        => false,
            'hierarchical'       => false,
            'show_in_rest'       => true,
            'show_in_nav_menus'  => true,
            'menu_icon'          => 'dashicons-store',
            'rewrite'            => array(
                'slug'       => 'room', // Make sure this slug is correct
                'with_front' => false,
            ),
        )
    );

    if (function_exists('wpml_register_post_type_for_translation')) {
        wpml_register_post_type_for_translation(self::POST_TYPE_ROOM, array(
            'name'               => __('Rooms'),
            'singular_name'      => __('Room'),
            'show_in_nav_menus'  => true,
            'public'             => true,
        ));
    }
});
Editor is loading...
Leave a Comment