Skip to content

Instantly share code, notes, and snippets.

@azdak
Created July 31, 2018 16:59
Show Gist options
  • Save azdak/305541ebdc3f69f9dcf34d6d29fc25f6 to your computer and use it in GitHub Desktop.
Save azdak/305541ebdc3f69f9dcf34d6d29fc25f6 to your computer and use it in GitHub Desktop.
dsa504wp Committee Plugin
<?php
/**
* Plugin Name: DSA504 Committees Plugin
* Description: Creates a 'committee' custom post type
* Version: 0.1
* Author: T. Daniel
* Author URI: http://tdanieldesign.com
* License: GPL2
* Copyright 2017 T. Daniel (email : trey@tdanieldesign.com)
*/
// to use, add this file (dsa-committeees.php) to a folder called "dsa-committees" in /wp-content/plugins
class DSA504Committee {
function __construct() {
add_action( 'init', array( $this, 'register_committee_post_type' ) );
}
function register_committee_post_type() {
register_post_type('committee', array(
'labels' => array(
'name' => _x( 'Committees', 'post type general name', 'pbos-loc' ),
'singular_name' => _x( 'Committee', 'post type singular name', 'pbos-loc' ),
'menu_name' => _x( 'Committees', 'admin menu', 'pbos-loc' ),
'name_admin_bar' => _x( 'Committee', 'add new on admin bar', 'pbos-loc' ),
'add_new' => _x( 'Add New', 'committee', 'pbos-loc' ),
'add_new_item' => __( 'Add New Committee', 'pbos-loc' ),
'new_item' => __( 'New Committee', 'pbos-loc' ),
'edit_item' => __( 'Edit Committee', 'pbos-loc' ),
'view_item' => __( 'View Committee', 'pbos-loc' ),
'all_items' => __( 'All Committees', 'pbos-loc' ),
'search_items' => __( 'Search Committees', 'pbos-loc' ),
'parent_item_colon' => __( 'Parent Committees:', 'pbos-loc' ),
'not_found' => __( 'No Committees found.', 'pbos-loc' ),
'not_found_in_trash' => __( 'No Committees found in Trash.', 'pbos-loc' ),
),
// Frontend
'has_archive' => false,
'public' => true,
'publicly_queryable' => true,
// Admin
'capability_type' => 'post',
'menu_icon' => 'dashicons-groups',
'query_var' => true,
'show_in_menu' => true,
'show_ui' => true,
'supports' => array(
'title',
'editor',
'author',
'page-attributes',
'custom-fields'
),
));
}
}
$init = new DSA504Committee;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment