forked from ubc/experts-migration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexperts_migration.php
52 lines (44 loc) · 2.23 KB
/
experts_migration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/*
Plugin Name: UBC Experts Migration
Author: Flynn O'Connor
Description: Custom WP CLI commands to migrate experts away from profile plugin. Adds custom taxonomy for Expert profiles.
Version: 0.1
*/
$plugin_dir = plugin_dir_path( __FILE__ );
if ( defined('WP_CLI') && WP_CLI ) {
include __DIR__ . '/experts-migration-commands.php';
}
// let's create the function for the custom type
function olt_exerpts_register_taxonomies() {
// custom post content type taxonomy
$content_type_template = array(
'tax_slug' => 'profile_field',
'tax_label' => 'Fields',
'tax_single' => 'Field',
'post_type' => array('post'),
'rewrite_slug' => 'field'
);
$args = array(
'hierarchical' => true, /* if this is true it acts like categories */
'labels' => array(
'name' => __( $content_type_template['tax_label'] ), /* name of the custom taxonomy */
'singular_name' => __( $content_type_template['tax_single'] ), /* single taxonomy name */
'search_items' => __( 'Search ' . $content_type_template['tax_label'] ), /* search title for taxomony */
'all_items' => __( 'All ' . $content_type_template['tax_label'] ), /* all title for taxonomies */
'parent_item' => __( 'Parent ' . $content_type_template['tax_single'] ), /* parent title for taxonomy */
'parent_item_colon' => __( 'Parent ' . $content_type_template['tax_single'] . ':' ), /* parent taxonomy title */
'edit_item' => __( 'Edit ' . $content_type_template['tax_single'] ), /* edit custom taxonomy title */
'update_item' => __( 'Update ' . $content_type_template['tax_single'] ), /* update title for taxonomy */
'add_new_item' => __( 'Add New ' . $content_type_template['tax_single'] ), /* add new title for taxonomy */
'new_item_name' => __( 'New ' . $content_type_template['tax_single'] . ' Name' ) /* name title for taxonomy */
),
'show_ui' => true,
'query_var' => true,
'show_in_rest' => true,
'rewrite' => array( 'slug' => $content_type_template['rewrite_slug'] ),
);
register_taxonomy( $content_type_template['tax_slug'], $content_type_template['post_type'] , $args );
}
// adding the function to the Wordpress init
add_action( 'init', 'olt_exerpts_register_taxonomies' );