Skip to content

Instantly share code, notes, and snippets.

@noeltock
Last active April 28, 2020 11:46
Show Gist options
  • Save noeltock/8475842 to your computer and use it in GitHub Desktop.
Save noeltock/8475842 to your computer and use it in GitHub Desktop.
<?php
/* Create Custom Post Type (CPT)
------------------------------------*/
function create_livestream_posttype() {
$args = array(
'label' => 'Livestream',
'public' => false,
);
register_post_type( 'livestream', $args );
}
add_action( 'init', 'create_livestream_posttype' );
/* Register Page for CPT
------------------------------------*/
function add_livestream_page() {
add_menu_page( 'Livestream', 'Livestream', 'edit_pages', 'livestream', 'create_livestream_page', '', 21 );
}
add_action( 'admin_menu', 'add_livestream_page' );
/* Create Page for CPT
------------------------------------*/
function create_livestream_page() {
?>
<h2>Hello World.</h2>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment