PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.7.8
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.7.8
2.7.9 2.7.8 2.7.7 2.7.6 2.7.5 2.7.4 trunk 1.3 2.0.4 2.0.6 2.1.91 2.2.4 2.2.7 2.2.9 2.3.1 2.3.10 2.4.10 2.4.2 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.6.0 All 30 releases
← All changes | admin/types/snippets-taxonomy.php +91 -48 2.1.91 → 2.7.8 View file →
@@ -1,48 +1,91 @@
1 -<?php
2 -
3 - class WINP_SnippetsTaxonomy extends Wbcr_FactoryTaxonomies325_Taxonomy {
4 -
5 - /**
6 - * Custom post name.
7 - * @var string
8 - */
9 - public $name = WINP_SNIPPETS_TAXONOMY;
10 - public $post_types = WINP_SNIPPETS_POST_TYPE;
11 -
12 - /**
13 - * Template that defines a set of type options.
14 - * Allowed values: public, private, internal.
15 - * @var string
16 - */
17 - public $template = 'private';
18 -
19 - /**
20 - * Capabilities for roles that have access to manage the type.
21 - * @link http://codex.wordpress.org/Roles_and_Capabilities
22 - * @var array
23 - */
24 - public $capabilities = array('administrator');
25 -
26 - function __construct($plugin)
27 - {
28 - $this->plural_title = __('Tags', 'insert-php');
29 - $this->singular_title = __('Tag', 'insert-php');
30 -
31 - $this->options['hierarchical'] = false;
32 - $this->options['show_admin_column'] = true;
33 - $this->options['show_in_nav_menus'] = true;
34 - $this->options['update_count_callback'] = ""; // use default handler
35 - $this->options['show_in_quick_edit'] = true;
36 -
37 - parent::__construct($plugin);
38 - }
39 -
40 - /**
41 - * Taxonomy configurator.
42 - */
43 - public function configure()
44 - {
45 - }
46 - }
47 -
48 -
1 +<?php
2 +/**
3 + * Snippets Taxonomy
4 + *
5 + * @package Woody_Code_Snippets
6 + */
7 +
8 +// Exit if accessed directly
9 +if ( ! defined( 'ABSPATH' ) ) {
10 + exit;
11 +}
12 +
13 +/**
14 + * Class WINP_SnippetsTaxonomy
15 + *
16 + * Handles registration of the snippets taxonomy.
17 + */
18 +class WINP_SnippetsTaxonomy {
19 +
20 + /**
21 + * Taxonomy name.
22 + *
23 + * @var string
24 + */
25 + private $name = WINP_SNIPPETS_TAXONOMY;
26 +
27 + /**
28 + * Post type(s) this taxonomy applies to.
29 + *
30 + * @var string
31 + */
32 + private $post_types = WINP_SNIPPETS_POST_TYPE;
33 +
34 + /**
35 + * Constructor.
36 + */
37 + public function __construct() {
38 + add_action( 'init', [ $this, 'register' ] );
39 + }
40 +
41 + /**
42 + * Register the taxonomy.
43 + *
44 + * @return void
45 + */
46 + public function register() {
47 + $labels = [
48 + 'name' => __( 'Tags', 'insert-php' ),
49 + 'singular_name' => __( 'Tag', 'insert-php' ),
50 + 'search_items' => __( 'Search Tags', 'insert-php' ),
51 + 'popular_items' => __( 'Popular Tags', 'insert-php' ),
52 + 'all_items' => __( 'All Tags', 'insert-php' ),
53 + 'parent_item' => __( 'Parent Tag', 'insert-php' ),
54 + 'parent_item_colon' => __( 'Parent Tag:', 'insert-php' ),
55 + 'edit_item' => __( 'Edit Tag', 'insert-php' ),
56 + 'update_item' => __( 'Update Tag', 'insert-php' ),
57 + 'add_new_item' => __( 'Add New Tag', 'insert-php' ),
58 + 'new_item_name' => __( 'New Tag Name', 'insert-php' ),
59 + 'separate_items_with_commas' => __( 'Separate Tags with commas', 'insert-php' ),
60 + 'add_or_remove_items' => __( 'Add or remove Tags', 'insert-php' ),
61 + 'choose_from_most_used' => __( 'Choose from the most used Tags', 'insert-php' ),
62 + 'not_found' => __( 'No Tags found.', 'insert-php' ),
63 + 'menu_name' => __( 'Tags', 'insert-php' ),
64 + ];
65 +
66 + $args = [
67 + 'labels' => $labels,
68 + 'public' => false,
69 + 'show_ui' => true,
70 + 'show_in_menu' => true,
71 + 'show_in_nav_menus' => true,
72 + 'show_tagcloud' => false,
73 + 'show_in_quick_edit' => true,
74 + 'show_admin_column' => true,
75 + 'show_in_rest' => false,
76 + 'hierarchical' => false,
77 + 'publicly_queryable' => false,
78 + 'exclude_from_search' => true,
79 + 'query_var' => true,
80 + 'rewrite' => false,
81 + 'capabilities' => [
82 + 'manage_terms' => 'manage_options',
83 + 'edit_terms' => 'manage_options',
84 + 'delete_terms' => 'manage_options',
85 + 'assign_terms' => 'manage_options',
86 + ],
87 + ];
88 +
89 + register_taxonomy( $this->name, $this->post_types, $args );
90 + }
91 +}