PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.7.9
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.7.9
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 -54 2.4.2 → 2.7.9 View file →
@@ -1,54 +1,91 @@
1 -<?php
2 -
3 -// Exit if accessed directly
4 -if ( ! defined( 'ABSPATH' ) ) {
5 - exit;
6 -}
7 -
8 - class WINP_SnippetsTaxonomy extends Wbcr_FactoryTaxonomies330_Taxonomy {
9 -
10 - /**
11 - * Custom post name.
12 - * @var string
13 - */
14 - public $name = WINP_SNIPPETS_TAXONOMY;
15 -
16 - public $post_types = WINP_SNIPPETS_POST_TYPE;
17 -
18 - /**
19 - * Template that defines a set of type options.
20 - * Allowed values: public, private, internal.
21 - * @var string
22 - */
23 - public $template = 'private';
24 -
25 - /**
26 - * Capabilities for roles that have access to manage the type.
27 - * @link http://codex.wordpress.org/Roles_and_Capabilities
28 - * @var array
29 - */
30 - public $capabilities = array('administrator');
31 -
32 - function __construct($plugin)
33 - {
34 - $this->plural_title = __( 'Tags', 'insert-php' );
35 - $this->singular_title = __( 'Tag', 'insert-php' );
36 -
37 - $this->options['hierarchical'] = false;
38 - $this->options['show_admin_column'] = true;
39 - $this->options['show_in_nav_menus'] = true;
40 - $this->options['update_count_callback'] = ''; // use default handler
41 - $this->options['show_in_quick_edit'] = true;
42 -
43 - parent::__construct( $plugin );
44 - }
45 -
46 - /**
47 - * Taxonomy configurator.
48 - */
49 - public function configure()
50 - {
51 - }
52 - }
53 -
54 -
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 +}