Skip to content

Instantly share code, notes, and snippets.

@mzalewski
Last active January 28, 2017 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mzalewski/7365db7185c821645a2232df184f4247 to your computer and use it in GitHub Desktop.
Save mzalewski/7365db7185c821645a2232df184f4247 to your computer and use it in GitHub Desktop.
WordPress Custom Post Type
<?php
function myplugin_add_post_type() {
register_post_type( 'reviews',
array(
'labels' => array(
'name' => __( 'Reviews' ),
'singular_name' => __( 'Review' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'reviews'),
)
);
}
// Hooking up our function to theme setup
add_action( 'init', 'myplugin_add_post_type' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment