Skip to content

Instantly share code, notes, and snippets.

/clinics.php Secret

Created Sep 28, 2015
Embed
What would you like to do?
<?php
/**
* Plugin Name: Clinics
* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
* Description: Add custom clinics
* Version: 1.0.0
* Author: Ilhami Dogan
* Author URI:
* Text Domain: Optional. Plugin's text domain for localization. Example: mytextdomain
* Domain Path: Optional. Plugin's relative directory path to .mo files. Example: /locale/
* Network: true
* License: GPL2
*/
// Register Custom Post Type
function custom_post_type_clinics() {
$labels = array(
'name' => _x( 'laegeklinik', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Clinic', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Clinics', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'all_items' => __( 'All Clinics', 'text_domain' ),
'view_item' => __( 'View Clinic', 'text_domain' ),
'add_new_item' => __( 'Add New Clinic', 'text_domain' ),
'add_new' => __( 'Add New Clinic', 'text_domain' ),
'edit_item' => __( 'Edit Clinic', 'text_domain' ),
'update_item' => __( 'Update Clinic', 'text_domain' ),
'search_items' => __( 'Search Clinic', 'text_domain' ),
'not_found' => __( 'No clinics found', 'text_domain' ),
'not_found_in_trash' => __( 'No clinics found in Trash', 'text_domain' ),
);
$args = array(
'labels' => $labels,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'custom-fields' ),
'taxonomies' => array( 'category', 'post_tag', '' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'rewrite' => array('slug' => 'laegeklinik', 'with_front' => false)
);
register_post_type( 'laegeklinik', $args );
}
// Register Custom Taxonomy
function nm_staff_taxonomy() {
$labels = array(
'name' => _x( 'Staff Members', 'Taxonomy General Name', 'nm' ),
'singular_name' => _x( 'Staff Member', 'Taxonomy Singular Name', 'nm' ),
'menu_name' => __( 'Staff Members', 'nm' ),
'all_items' => __( 'All Items', 'nm' ),
'parent_item' => __( 'Parent Item', 'nm' ),
'parent_item_colon' => __( 'Parent Item:', 'nm' ),
'new_item_name' => __( 'New Item Name', 'nm' ),
'add_new_item' => __( 'Add New Item', 'nm' ),
'edit_item' => __( 'Edit Item', 'nm' ),
'update_item' => __( 'Update Item', 'nm' ),
'separate_items_with_commas' => __( 'Separate items with commas', 'nm' ),
'search_items' => __( 'Search Items', 'nm' ),
'add_or_remove_items' => __( 'Add or remove items', 'nm' ),
'choose_from_most_used' => __( 'Choose from the most used items', 'nm' ),
'not_found' => __( 'Not Found', 'nm' ),
);
$rewrite = array(
'slug' => 'staff',
'with_front' => false,
'hierarchical' => false,
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
'rewrite' => $rewrite,
);
register_taxonomy( 'staff_taxonomy', array( 'laegeklinik' ), $args );
}
// Hook into the 'init' action
add_action( 'init', 'nm_staff_taxonomy', 0 );
// Hook into the 'init' action
add_action( 'init', 'custom_post_type_clinics', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment