Last active
May 23, 2019 21:26
-
-
Save bradpotter/657156fc93dcb27ffb6a31bbffbe8f67 to your computer and use it in GitHub Desktop.
First run at Bible Verse CPT
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
add_action( 'init', 'book_create_custom_taxonomy' ); | |
function book_create_custom_taxonomy() { | |
// Book | |
$book = array( | |
'name' => _x( 'Book', 'taxonomy general name' ), | |
'singular_name' => _x( 'Book', 'taxonomy singular name' ), | |
'menu_name' => __( 'Book' ), | |
'all_items' => __( 'All Books' ), | |
'parent_item' => __( 'Parent Book' ), | |
'parent_item_colon' => __( 'Parent Book:' ), | |
'new_item_name' => __( 'New Book' ), | |
'add_new_item' => __( 'Add new Book' ), | |
'edit_item' => __( 'Edit Book' ), | |
'update_item' => __( 'Update Book' ), | |
'view_item' => __( 'View Book' ), | |
'separate_items_with_commas' => __( 'Separate books with commas' ), | |
'add_or_remove_items' => __( 'Add or remove items' ), | |
'choose_from_most_used' => __( 'Choose from books most used' ), | |
'popular_items' => __( 'Popular Items' ), | |
'search_items' => __( 'Search in Books' ), | |
'not_found' => __( 'Not Found' ), | |
'no_terms' => __( 'No items' ), | |
'items_list' => __( 'Items list' ), | |
'items_list_navigation' => __( 'Items list navigation' ), | |
); | |
$args = array( | |
'hierarchical' => false, | |
'labels' => $book, | |
'show_ui' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'book' ), | |
'show_in_rest' => true, | |
); | |
register_taxonomy( 'book', array( 'verse' ), $args ); | |
} | |
add_action( 'init', 'testament_create_custom_taxonomy' ); | |
function testament_create_custom_taxonomy() { | |
// Testament | |
$testament = array( | |
'name' => _x( 'Testament', 'taxonomy general name' ), | |
'singular_name' => _x( 'Testament', 'taxonomy singular name' ), | |
'search_items' => __( 'Search in Testaments' ), | |
'all_items' => __( 'All Testaments' ), | |
'most_used_items' => null, | |
'parent_item' => __( 'Parent Testament' ), | |
'parent_item_colon' => null, | |
'edit_item' => __( 'Edit Testament' ), | |
'update_item' => __( 'Update Testament' ), | |
'add_new_item' => __( 'Add new Testament' ), | |
'new_item_name' => __( 'New Testament' ), | |
'menu_name' => __( 'Testament' ), | |
); | |
$args = array( | |
'hierarchical' => true, | |
'labels' => $testament, | |
'show_ui' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'testament' ), | |
'show_in_rest' => true, | |
); | |
register_taxonomy( 'testament', array( 'verse' ), $args ); | |
} | |
add_action( 'init', 'verse_create_custom_post_type' ); | |
function verse_create_custom_post_type() { | |
$labels = array( | |
'name' => __( 'Verse' ), | |
'singular_name' => __( 'Verses' ), | |
'all_items' => __( 'All Verses' ), | |
'add_new' => _x( 'Add new Verse', 'Verses' ), | |
'add_new_item' => __( 'Add new Verse' ), | |
'edit_item' => __( 'Edit Verse' ), | |
'new_item' => __( 'New Verse' ), | |
'view_item' => __( 'View Verse' ), | |
'search_items' => __( 'Search in Verses' ), | |
'not_found' => __( 'No Verses found' ), | |
'not_found_in_trash' => __( 'No Verses found in trash' ), | |
'parent_item_colon' => '', | |
); | |
$args = array( | |
'labels' => $labels, | |
'public' => true, | |
'has_archive' => true, // Set to false hides Archive Pages | |
'menu_icon' => 'dashicons-book-alt', // pick one here ~> https://developer.wordpress.org/resource/dashicons/ | |
'rewrite' => array( 'slug' => 'verse' ), | |
'taxonomies' => array( 'book', 'testament' ), // category, post_tag | |
'query_var' => true, | |
'menu_position' => 5, | |
'supports' => array( 'thumbnail' , 'custom-fields', 'excerpt', 'comments', 'title', 'editor', 'genesis-seo', 'genesis-cpt-archives-settings' ), | |
'show_ui' => true, // Set to false hides from ui | |
'show_in_menu' => true, // Set to false hides from menu | |
'show_in_rest' => true, | |
); | |
register_post_type( 'verse', $args ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment