WordPress: Custom post types plugin #snippet #WordPress
<?php
/*
Plugin Name: "Site Name" Custom Post Types
Description: Custom Post Types for "Theme Name" theme.
Author: Jen Huls
Author URI: http://leadbellydesign.com
*/
// Clients
add_action( 'init', 'site_name_cpt' );
function site_name_cpt() {
register_post_type( 'custom_post_type', array(
'labels' => array(
'name' => 'CPT Names',
'singular_name' => 'CPT Names',
),
'description' => 'CPT Names details.',
'public' => true,
'menu_icon' => 'dashicons-menu',
'menu_position' => 20,
'supports' => array( 'title', 'editor' )
));
}
This allows custom post type information to work within any theme without having to copy/paste from functions files to new theme.
Upload to wp-content > plugins
I also place the following snippets in the plugin file:
####Resources: