I want to know if i can add two different custom post types to my wordpress site

As Jacob Peattie pointed out in this comment, the reason why you code isn’t working is because you have two functions with same name create_posttype. PHP assumes you want to re-declare the function, which you cannot do.

So in order for your code to work, you can either combine your custom post types creation into one function (as Jacob suggests):

    // Our custom post type function
function create_posttype() {
 
    register_post_type( 'articles',
    // CPT Options
        array(
            'labels' => array(
                'name' => __( 'Articles' ),
                'singular_name' => __( 'Article' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'articles'),
            'show_in_rest' => true,
 
        )
    );

    register_post_type( 'projects',
    // CPT Options
        array(
            'labels' => array(
                'name' => __( 'Projects' ),
                'singular_name' => __( 'Project' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'projects'),
            'show_in_rest' => true,
 
        )
    );
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );

… or give each function an unique name if you prefer to use two functions:

    // Our custom post type function
function create_posttype_articles() {
 
    register_post_type( 'articles',
    // CPT Options
        array(
            'labels' => array(
                'name' => __( 'Articles' ),
                'singular_name' => __( 'Article' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'articles'),
            'show_in_rest' => true,
 
        )
    );
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype_articles' );


// Our custom post type function
function create_posttype_projects() {
 
    register_post_type( 'projects',
    // CPT Options
        array(
            'labels' => array(
                'name' => __( 'Projects' ),
                'singular_name' => __( 'Project' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'projects'),
            'show_in_rest' => true,
 
        )
    );
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype_projects' );

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş