Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Register Custom Post Type
- function ts_listings() {
- $labels = array(
- 'name' => _x( 'Listings', '', 'ts' ),
- 'singular_name' => _x( 'Listing', '', 'ts' ),
- 'menu_name' => __( 'Listings', 'ts' ),
- 'name_admin_bar' => __( 'Listing', 'ts' ),
- 'archives' => __( 'Item Archives', 'ts' ),
- 'parent_item_colon' => __( 'Parent Listing:', 'ts' ),
- 'all_items' => __( 'All Listings', 'ts' ),
- 'add_new_item' => __( 'Add New Listing', 'ts' ),
- 'add_new' => __( 'Add New', 'ts' ),
- 'new_item' => __( 'New Listing', 'ts' ),
- 'edit_item' => __( 'Edit Listing', 'ts' ),
- 'update_item' => __( 'Update Listing', 'ts' ),
- 'view_item' => __( 'View Listing', 'ts' ),
- 'search_items' => __( 'Search Listing', 'ts' ),
- 'not_found' => __( 'Not found', 'ts' ),
- 'not_found_in_trash' => __( 'Not found in Trash', 'ts' ),
- 'featured_image' => __( 'Featured Image', 'ts' ),
- 'set_featured_image' => __( 'Set featured image', 'ts' ),
- 'remove_featured_image' => __( 'Remove featured image', 'ts' ),
- 'use_featured_image' => __( 'Use as featured image', 'ts' ),
- 'insert_into_item' => __( 'Insert into Listing', 'ts' ),
- 'uploaded_to_this_item' => __( 'Uploaded to this Listing', 'ts' ),
- 'items_list' => __( 'Listings list', 'ts' ),
- 'items_list_navigation' => __( 'Listings list navigation', 'ts' ),
- 'filter_items_list' => __( 'Filter Listings list', 'ts' ),
- );
- $rewrite = array(
- 'slug' => 'listings',
- 'with_front' => true,
- 'pages' => true,
- 'feeds' => true,
- );
- $args = array(
- 'label' => __( 'Listing', 'ts' ),
- 'labels' => $labels,
- 'supports' => array(),
- 'hierarchical' => false,
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'menu_position' => 5,
- 'show_in_admin_bar' => true,
- 'show_in_nav_menus' => true,
- 'can_export' => true,
- 'has_archive' => true,
- 'exclude_from_search' => false,
- 'publicly_queryable' => true,
- 'capability_type' => 'page',
- 'rewrite' => $rewrite
- );
- register_post_type( 'ts-listings', $args );
- }
- add_action( 'init', 'ts_listings', 0 );
- // Register Custom Taxonomy
- function ts_listing_type() {
- $labels = array(
- 'name' => _x( 'Types', 'Taxonomy General Name', 'ts' ),
- 'singular_name' => _x( 'Type', 'Taxonomy Singular Name', 'ts' ),
- 'menu_name' => __( 'Type', 'ts' ),
- 'all_items' => __( 'All Types', 'ts' ),
- 'parent_item' => __( 'Parent Type', 'ts' ),
- 'parent_item_colon' => __( 'Parent Type:', 'ts' ),
- 'new_item_name' => __( 'New Type Name', 'ts' ),
- 'add_new_item' => __( 'Add New Type', 'ts' ),
- 'edit_item' => __( 'Edit Type', 'ts' ),
- 'update_item' => __( 'Update Type', 'ts' ),
- 'view_item' => __( 'View Type', 'ts' ),
- 'separate_items_with_commas' => __( 'Separate items with commas', 'ts' ),
- 'add_or_remove_items' => __( 'Add or remove items', 'ts' ),
- 'choose_from_most_used' => __( 'Choose from the most used', 'ts' ),
- 'popular_items' => __( 'Popular Types', 'ts' ),
- 'search_items' => __( 'Search Items', 'ts' ),
- 'not_found' => __( 'Not Found', 'ts' ),
- 'no_terms' => __( 'No items', 'ts' ),
- 'items_list' => __( 'Items list', 'ts' ),
- 'items_list_navigation' => __( 'Items list navigation', 'ts' ),
- );
- $rewrite = array(
- 'slug' => 'listing-types',
- 'with_front' => true,
- 'hierarchical' => false,
- );
- $args = array(
- 'labels' => $labels,
- 'hierarchical' => false,
- 'public' => true,
- 'show_ui' => true,
- 'show_admin_column' => true,
- 'show_in_nav_menus' => true,
- 'show_tagcloud' => true,
- 'rewrite' => $rewrite,
- );
- register_taxonomy( 'ts-listing-type', array( 'ts-listings' ), $args );
- }
- add_action( 'init', 'ts_listing_type', 0 );
- add_filter( 'rwmb_meta_boxes', 'ts_listings_register_meta_boxes' );
- function ts_listings_register_meta_boxes($meta_boxes)
- {
- global $prefix;
- $meta_boxes[] = array(
- 'title' => __( "Details", 'no-translate' ),
- 'pages' => array( 'ts-listings' ),
- 'fields' => array(
- array(
- 'id' => "{$prefix}listing_featured",
- 'type' => 'checkbox',
- 'name' => __( 'Featured', 'no-translate' ),
- ),
- array(
- 'id' => "{$prefix}listing_sold",
- 'type' => 'checkbox',
- 'name' => __( 'Sold', 'no-translate' ),
- ),
- array(
- 'id' => "{$prefix}listing_sale_pending",
- 'type' => 'checkbox',
- 'name' => __( 'Sale Pending', 'no-translate' ),
- ),
- array(
- 'id' => "{$prefix}listing_reduced_price",
- 'type' => 'checkbox',
- 'name' => __( 'Price Reduced', 'no-translate' ),
- ),
- array(
- 'id' => "{$prefix}mls_no_maine",
- 'type' => 'text',
- 'name' => __( 'Maine MLS #', 'no-translate' ),
- ),
- array(
- 'id' => "{$prefix}mls_no_nh",
- 'type' => 'text',
- 'name' => __( 'New Hampshire MLS #', 'no-translate' ),
- ),
- array(
- 'id' => "{$prefix}listing_num",
- 'type' => 'text',
- 'name' => __( 'MLS Code:', 'no-translate' ),
- ),
- array(
- 'id' => "{$prefix}listing_address",
- 'type' => 'textarea',
- 'name' => __( 'Address', 'no-translate' ),
- ),
- // array(
- // 'id' => "{$prefix}listing_city",
- // 'type' => 'text',
- // 'name' => __( 'City', 'no-translate' ),
- // ),
- // array(
- // 'id' => "{$prefix}listing_state",
- // 'type' => 'text',
- // 'name' => __( 'State', 'no-translate' ),
- // ),
- // array(
- // 'id' => "{$prefix}listing_zip",
- // 'type' => 'text',
- // 'name' => __( 'Zip', 'no-translate' ),
- // ),
- array(
- 'id' => "{$prefix}listing_price",
- 'type' => 'text',
- 'name' => __( 'Price ($)', 'no-translate' ),
- ),
- array(
- 'id' => "{$prefix}listing_images",
- 'type' => 'image_advanced',
- 'name' => __( 'Images', 'no-translate' ),
- ),
- array(
- 'id' => "{$prefix}listing_the_realtors",
- 'type' => 'group',
- 'clone' => true,
- 'fields' => array(
- array(
- 'id' => "email",
- 'type' => 'email',
- 'name' => __( 'Email', 'no-translate' ),
- ),
- ),
- 'name' => __( 'Realtors', 'no-translate' ),
- ),
- array(
- 'id' => "{$prefix}listing_coordinates",
- 'type' => 'text',
- 'name' => __( 'Map', 'no-translate' ),
- ),
- )
- );
- return $meta_boxes;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement