Created
December 26, 2014 14:37
-
-
Save n7studios/8d7bcddc44ac6b84600d to your computer and use it in GitHub Desktop.
Tuts+ Create a Simple CRM in WordPress: Part 1
This file contains 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
<?php | |
/** | |
* Plugin Name: Tuts+ CRM | |
* Plugin URI: # | |
* Version: 1.0 | |
* Author: Tuts+ | |
* Author URI: http://code.tutsplus.com | |
* Description: A simple CRM system for WordPress | |
* License: GPL2 | |
*/ | |
class WPTutsCRM { | |
/** | |
* Constructor. Called when plugin is initialised | |
*/ | |
function __construct() { | |
add_action( 'init', array( &$this, 'register_custom_post_type' ) ); | |
} | |
/** | |
* Registers a Custom Post Type called contact | |
*/ | |
function register_custom_post_type() { | |
register_post_type( 'contact', array( | |
'labels' => array( | |
'name' => _x( 'Contacts', 'post type general name', 'tuts-crm' ), | |
'singular_name' => _x( 'Contact', 'post type singular name', 'tuts-crm' ), | |
'menu_name' => _x( 'Contacts', 'admin menu', 'tuts-crm' ), | |
'name_admin_bar' => _x( 'Contact', 'add new on admin bar', 'tuts-crm' ), | |
'add_new' => _x( 'Add New', 'contact', 'tuts-crm' ), | |
'add_new_item' => __( 'Add New Contact', 'tuts-crm' ), | |
'new_item' => __( 'New Contact', 'tuts-crm' ), | |
'edit_item' => __( 'Edit Contact', 'tuts-crm' ), | |
'view_item' => __( 'View Contact', 'tuts-crm' ), | |
'all_items' => __( 'All Contacts', 'tuts-crm' ), | |
'search_items' => __( 'Search Contacts', 'tuts-crm' ), | |
'parent_item_colon' => __( 'Parent Contacts:', 'tuts-crm' ), | |
'not_found' => __( 'No contacts found.', 'tuts-crm' ), | |
'not_found_in_trash' => __( 'No contacts found in Trash.', 'tuts-crm' ), | |
), | |
// Frontend | |
'has_archive' => false, | |
'public' => false, | |
'publicly_queryable' => false, | |
// Admin | |
'capability_type' => 'post', | |
'menu_icon' => 'dashicons-businessman', | |
'menu_position' => 10, | |
'query_var' => true, | |
'show_in_menu' => true, | |
'show_ui' => true, | |
'supports' => array( | |
'title', | |
'author', | |
'comments', | |
), | |
) ); | |
} | |
} | |
$wpTutsCRM = new WPTutsCRM; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment