Created
August 5, 2022 10:59
-
-
Save wp126/1d7670c6e57293a5594770e1995d192e to your computer and use it in GitHub Desktop.
create custom post type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function create_posttype() { | |
register_post_type( 'movies', | |
// CPT Options | |
array( | |
'labels' => array( | |
'name' => __( 'Movies' ), | |
'singular_name' => __( 'Movie' ) | |
), | |
'public' => true, | |
'has_archive' => true, | |
'rewrite' => array('slug' => 'movies'), | |
'show_in_rest' => true, | |
) | |
); | |
} | |
// Hooking up our function to theme setup | |
add_action( 'init', 'create_posttype' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment