Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: Listings
- Plugin URI: http://example.co.uk/
- Description: Declares a plugin that will create a custom post type displaying Neighbourgood Listings.
- Version: 1.0
- Author: Martin Coleman on the back of the WP Generator
- Author URI: http://example.co.uk/
- License: GPLv2
- */
- //Custom Post Type for Listing
- if ( ! function_exists('nbrgd_listing') ) {
- // Register Custom Post Type
- function nbrgd_listing() {
- $labels = array(
- 'name' => _x( 'Listings', 'Post Type General Name', 'text_domain' ),
- 'singular_name' => _x( 'Listing', 'Post Type Singular Name', 'text_domain' ),
- 'menu_name' => __( 'NBRGD Listing', 'text_domain' ),
- 'parent_item_colon' => __( 'Parent Organisation', 'text_domain' ),
- 'all_items' => __( 'Listings', 'text_domain' ),
- 'view_item' => __( 'View Listings', 'text_domain' ),
- 'add_new_item' => __( 'Add New Listing', 'text_domain' ),
- 'add_new' => __( 'New Listing', 'text_domain' ),
- 'edit_item' => __( 'Edit Listing', 'text_domain' ),
- 'update_item' => __( 'Update Listing', 'text_domain' ),
- 'search_items' => __( 'Search Listings', 'text_domain' ),
- 'not_found' => __( 'Listings Not Found', 'text_domain' ),
- 'not_found_in_trash' => __( 'No Listings in Trash', 'text_domain' ),
- );
- $args = array(
- 'label' => __( 'Listing', 'text_domain' ),
- 'description' => __( 'Neighbourgood Listing', 'text_domain' ),
- 'labels' => $labels,
- 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'custom-fields', 'page-attributes', ),
- 'taxonomies' => array( 'post_type', 'organisation', 'organisation_sub' ),//, 'region', 'sub_type' 'category',
- 'hierarchical' => true,
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'show_in_nav_menus' => true,
- 'show_in_admin_bar' => true,
- 'menu_position' => 10,
- 'menu_icon' => '/img/icon.img',
- 'can_export' => true,
- 'has_archive' => true,
- 'exclude_from_search' => false,
- 'publicly_queryable' => true,
- 'capability_type' => 'post',
- );
- register_post_type( 'listing', $args );
- }
- // Hook into the 'init' action
- add_action( 'init', 'nbrgd_listing', 0 );
- }
- // Register Custom Taxonomy
- if ( ! function_exists('custom_taxonomy') ) {
- // Register Custom Taxonomy
- function custom_taxonomy() {
- $labels = array(
- 'name' => _x( 'Organisation Types', 'Taxonomy General Name', 'text_domain' ),
- 'singular_name' => _x( 'Organisation Type', 'Taxonomy Singular Name', 'text_domain' ),
- 'menu_name' => __( 'Organisation Type', 'text_domain' ),
- 'all_items' => __( 'All Organisation Types', 'text_domain' ),
- 'parent_item' => __( 'Parent Organisation Type', 'text_domain' ),
- 'parent_item_colon' => __( 'Parent Organisation', 'text_domain' ),
- 'new_item_name' => __( 'New Organisation Type', 'text_domain' ),
- 'add_new_item' => __( 'Add New Organisation Type', 'text_domain' ),
- 'edit_item' => __( 'Edit Organisation Type', 'text_domain' ),
- 'update_item' => __( 'Update Organisation Type', 'text_domain' ),
- 'separate_items_with_commas' => __( 'Separate Organisation Types with commas', 'text_domain' ),
- 'search_items' => __( 'Search Organisation Type', 'text_domain' ),
- 'add_or_remove_items' => __( 'Add or remove Organisation Type', 'text_domain' ),
- 'choose_from_most_used' => __( 'Choose from the most used Organisation Type', 'text_domain' ),
- );
- $args = array(
- 'labels' => $labels,
- 'hierarchical' => true,
- 'public' => true,
- 'show_ui' => true,
- 'show_admin_column' => true,
- 'show_in_nav_menus' => true,
- 'show_tagcloud' => true,
- );
- register_taxonomy( 'organisation', 'listing', $args );
- }
- // Hook into the 'init' action
- add_action( 'init', 'custom_taxonomy', 0 );
- }
- if ( ! function_exists('custom_taxonomy') ) {
- // Register Custom Taxonomy
- function custom_taxonomy() {
- $labels = array(
- 'name' => _x( 'Organisation Sub-Types', 'Taxonomy General Name', 'text_domain' ),
- 'singular_name' => _x( 'Organisation Sub-Type', 'Taxonomy Singular Name', 'text_domain' ),
- 'menu_name' => __( 'Organisation Sub-Type', 'text_domain' ),
- 'all_items' => __( 'All Organisation Sub-Types', 'text_domain' ),
- 'parent_item' => __( 'Parent Organisation Sub-Type', 'text_domain' ),
- 'parent_item_colon' => __( 'Parent Organisation', 'text_domain' ),
- 'new_item_name' => __( 'New Organisation Sub-Type', 'text_domain' ),
- 'add_new_item' => __( 'Add New Organisation Sub-Type', 'text_domain' ),
- 'edit_item' => __( 'Edit Organisation Sub-Type', 'text_domain' ),
- 'update_item' => __( 'Update Organisation Sub-Type', 'text_domain' ),
- 'separate_items_with_commas' => __( 'Separate Organisation vTypes with commas', 'text_domain' ),
- 'search_items' => __( 'Search Organisation Sub-Type', 'text_domain' ),
- 'add_or_remove_items' => __( 'Add or remove Organisation Sub-Type', 'text_domain' ),
- 'choose_from_most_used' => __( 'Choose from the most used Organisation Sub-Type', 'text_domain' ),
- );
- $args = array(
- 'labels' => $labels,
- 'hierarchical' => true,
- 'public' => true,
- 'show_ui' => true,
- 'show_admin_column' => true,
- 'show_in_nav_menus' => true,
- 'show_tagcloud' => true,
- );
- register_taxonomy( 'organisation_sub', 'listing', $args );
- }
- // Hook into the 'init' action
- add_action( 'init', 'custom_taxonomy', 0 );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement