PluginProbe
WP Directory Kit / 1.5.0
WP Directory Kit v1.5.0
1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 1.4.0 1.4.1 All 35 releases
wpdirectorykit / custom_post_type.php

custom_post_type.php in WP Directory Kit 1.5.0, at custom_post_type.php

72 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly.
5 }
6
7 /*
8 * Creating a function to create our CPT
9 */
10
11 function wdk_custom_post_type() {
12
13 // Set UI labels for Custom Post Type
14 $labels = array(
15 'name' => _x( 'WDK-Listings', 'Post Type General Name', 'wpdirectorykit' ),
16 'singular_name' => _x( 'Listing', 'Post Type Singular Name', 'wpdirectorykit' ),
17 'menu_name' => __( 'WDK-Listings', 'wpdirectorykit' ),
18 'parent_item_colon' => __( 'Parent Listing', 'wpdirectorykit' ),
19 'all_items' => __( 'All Listings', 'wpdirectorykit' ),
20 'view_item' => __( 'View Listing', 'wpdirectorykit' ),
21 'add_new_item' => __( 'Add New Listing', 'wpdirectorykit' ),
22 'add_new' => __( 'Add New', 'wpdirectorykit' ),
23 'edit_item' => __( 'Edit Listing', 'wpdirectorykit' ),
24 'update_item' => __( 'Update Listing', 'wpdirectorykit' ),
25 'search_items' => __( 'Search Listing', 'wpdirectorykit' ),
26 'not_found' => __( 'Not Found', 'wpdirectorykit' ),
27 'not_found_in_trash' => __( 'Not found in Trash', 'wpdirectorykit' ),
28 );
29
30 // Set other options for Custom Post Type
31
32 $args = array(
33 'label' => __( 'Listings', 'wpdirectorykit' ),
34 'description' => __( 'Listing', 'wpdirectorykit' ),
35 'labels' => $labels,
36 // Features this CPT supports in Post Editor
37 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'custom-fields', 'elementor' ),
38 // You can associate this CPT with a taxonomy or custom taxonomy.
39 'taxonomies' => array( ),
40 /* A hierarchical CPT is like Pages and can have
41 * Parent and child items. A non-hierarchical CPT
42 * is like Posts.
43 */
44 'hierarchical' => false,
45 'public' => true,
46 'show_ui' => false,
47 'show_in_menu' => true,
48 'show_in_nav_menus' => true,
49 'show_in_admin_bar' => true,
50 'menu_position' => 30,
51 'can_export' => true,
52 'has_archive' => false,
53 'exclude_from_search' => true,
54 'publicly_queryable' => true,
55 'capability_type' => 'page',
56 'show_in_rest' => true,
57 'menu_icon' => 'dashicons-category',
58 );
59
60 // Registering your Custom Post Type
61 register_post_type( 'wdk-listing', $args );
62
63 }
64
65 /* Hook into the 'init' action so that the function
66 * Containing our post type registration is not
67 * unnecessarily executed.
68 */
69
70 add_action( 'init', 'wdk_custom_post_type', 0 );
71
72