Skip to content

Instantly share code, notes, and snippets.

@n7studios
Created December 26, 2014 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save n7studios/8d7bcddc44ac6b84600d to your computer and use it in GitHub Desktop.
Save n7studios/8d7bcddc44ac6b84600d to your computer and use it in GitHub Desktop.
Tuts+ Create a Simple CRM in WordPress: Part 1
<?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