Last active
September 10, 2018 15:53
-
-
Save paaljoachim/1458a46011ec5e6ca2f93954d5f2745e to your computer and use it in GitHub Desktop.
Using the CPT - Custom Post Type UI plugin to create Custom Post Types
This file contains hidden or 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
function cptui_register_my_cpts() { | |
/** | |
* Post Type: Nettmagasin. | |
*/ | |
$labels = array( | |
"name" => __( "Nettmagasin", "tm-beans" ), | |
"singular_name" => __( "Nettmagasin", "tm-beans" ), | |
"all_items" => __( "Alle Nettmag tekster", "tm-beans" ), | |
"archives" => __( "Nettmagasin arkiv", "tm-beans" ), | |
); | |
$args = array( | |
"label" => __( "Nettmagasin", "tm-beans" ), | |
"labels" => $labels, | |
"description" => "", | |
"public" => true, | |
"publicly_queryable" => true, | |
"show_ui" => true, | |
"show_in_rest" => true, | |
"rest_base" => "", | |
"has_archive" => "nettmagasin-arkiv", | |
"show_in_menu" => true, | |
"show_in_nav_menus" => true, | |
"exclude_from_search" => false, | |
"capability_type" => "post", | |
"map_meta_cap" => true, | |
"hierarchical" => true, | |
"rewrite" => array( "slug" => "nettmagasin", "with_front" => true ), | |
"query_var" => true, | |
"menu_position" => 5, | |
"menu_icon" => "dashicons-calendar-alt", | |
"supports" => array( "title", "editor", "thumbnail", "excerpt", "custom-fields", "comments", "revisions", "author" ), | |
"taxonomies" => array( "nettmagasin_kategorier", "nettmagasin_stikkord" ), | |
); | |
register_post_type( "nettmagasin", $args ); | |
/** | |
* Post Type: Edwien. | |
*/ | |
$labels = array( | |
"name" => __( "Edwien", "tm-beans" ), | |
"singular_name" => __( "Edwien", "tm-beans" ), | |
"menu_name" => __( "Edwien", "tm-beans" ), | |
"all_items" => __( "Alle Edwiens tekster", "tm-beans" ), | |
"archives" => __( "Edwiens arkiv", "tm-beans" ), | |
); | |
$args = array( | |
"label" => __( "Edwien", "tm-beans" ), | |
"labels" => $labels, | |
"description" => "Edwiens Tekster", | |
"public" => true, | |
"publicly_queryable" => true, | |
"show_ui" => true, | |
"show_in_rest" => true, | |
"rest_base" => "", | |
"has_archive" => "edwiens-arkiv", | |
"show_in_menu" => true, | |
"show_in_nav_menus" => true, | |
"exclude_from_search" => false, | |
"capability_type" => "post", | |
"map_meta_cap" => true, | |
"hierarchical" => true, | |
"rewrite" => array( "slug" => "edwien", "with_front" => true ), | |
"query_var" => true, | |
"menu_position" => 5, | |
"menu_icon" => "dashicons-admin-users", | |
"supports" => array( "title", "editor", "thumbnail", "excerpt", "author" ), | |
"taxonomies" => array( "edwien_kategori", "edwien_stikkord" ), | |
); | |
register_post_type( "edwien", $args ); | |
} | |
add_action( 'init', 'cptui_register_my_cpts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Post meta is not showing up on the custom archive or single custom post pages.
and