1: <?php
2: /**
3: * Register post type Contact
4: *
5: * @package EPL
6: * @subpackage PostTypes/Contact
7: * @copyright Copyright (c) 2020, Merv Barrett
8: * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9: * @since 3.0
10: */
11:
12: // Exit if accessed directly.
13: if ( ! defined( 'ABSPATH' ) ) {
14: exit;
15: }
16:
17: /**
18: * Registers and sets up the Contact custom post type
19: *
20: * @since 3.0
21: * @since 3.5.1 Plural for viewing contacts.
22: *
23: * @return void
24: */
25: function epl_register_custom_post_type_contact() {
26:
27: $archives = defined( 'EPL_CONTACT_DISABLE_ARCHIVE' ) && EPL_CONTACT_DISABLE_ARCHIVE ? false : true;
28: $slug = defined( 'EPL_CONTACT_SLUG' ) ? EPL_CONTACT_SLUG : 'epl-contact';
29: $rewrite = defined( 'EPL_CONTACT_DISABLE_REWRITE' ) && EPL_CONTACT_DISABLE_REWRITE ? false : array(
30: 'slug' => $slug,
31: 'with_front' => false,
32: );
33:
34: $labels = apply_filters(
35: 'epl_contact_labels',
36: array(
37: 'name' => __( 'Contacts', 'easy-property-listings' ),
38: 'singular_name' => __( 'Contact', 'easy-property-listings' ),
39: 'menu_name' => __( 'Contact', 'easy-property-listings' ),
40: 'add_new' => __( 'Add New', 'easy-property-listings' ),
41: 'add_new_item' => __( 'Add New Contact', 'easy-property-listings' ),
42: 'edit_item' => __( 'Edit Contact', 'easy-property-listings' ),
43: 'new_item' => __( 'New Contact', 'easy-property-listings' ),
44: 'update_item' => __( 'Update Contact', 'easy-property-listings' ),
45: 'all_items' => __( 'All Contacts', 'easy-property-listings' ),
46: 'view_item' => __( 'View Contact', 'easy-property-listings' ),
47: 'view_items' => __( 'View Contacts', 'easy-property-listings' ),
48: 'search_items' => __( 'Search Contact', 'easy-property-listings' ),
49: 'not_found' => __( 'Contact Not Found', 'easy-property-listings' ),
50: 'not_found_in_trash' => __( 'Contact Not Found in Trash', 'easy-property-listings' ),
51: 'parent_item_colon' => __( 'Parent Contact:', 'easy-property-listings' ),
52: )
53: );
54:
55: $contact_args = array(
56: 'labels' => $labels,
57: 'public' => false,
58: 'publicly_queryable' => false,
59: 'show_ui' => true,
60: 'show_in_menu' => false,
61: 'query_var' => false,
62: 'rewrite' => $rewrite,
63: 'menu_icon' => 'dashicons-admin-home',
64: 'capability_type' => 'post',
65: 'has_archive' => $archives,
66: 'hierarchical' => false,
67: 'supports' => apply_filters( 'epl_contact_supports', array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ) ),
68: );
69: register_post_type( 'epl_contact', apply_filters( 'epl_contact_post_type_args', $contact_args ) );
70: }
71: add_action( 'init', 'epl_register_custom_post_type_contact', 0 );
72: