PluginProbe ʕ •ᴥ•ʔ
Admin Columns / 2.4.8
Admin Columns v2.4.8
7.1.4 7.0.19 2.3.5 2.4 2.4.1 2.4.10 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.6.1 2.5.6.2 2.5.6.3 2.5.6.4 3.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.7 3.1 3.1.1 3.1.10 3.1.2 3.1.3 3.1.5 3.2.3 3.2.7 3.3.1 3.4.1 3.4.6 3.4.8 4.0.1 4.0.3 4.1.6 4.2.2 4.2.5 4.3 4.3.2 4.4.1 4.4.4 4.4.5 4.5.5 4.6.1 4.7.18 4.7.19 4.7.20 4.7.7 7.0.13 7.0.14 7.0.16 trunk 1.0 1.1 1.1.3 1.2 1.2.1 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.5.1 1.4.6 1.4.6.1 1.4.6.2 1.4.6.3 1.4.6.4 1.4.7 1.4.8 1.4.9 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.1.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.5.1 2.2.6 2.2.6.1 2.2.6.2 2.2.6.3 2.2.6.4 2.2.7 2.2.8 2.2.8.1 2.2.9 2.3.1 2.3.2 2.3.3
codepress-admin-columns / classes / column / taxonomy.php
codepress-admin-columns / classes / column Last commit date
comment 10 years ago link 10 years ago media 10 years ago post 10 years ago user 10 years ago acf-placeholder.php 10 years ago actions.php 10 years ago custom-field.php 10 years ago default.php 10 years ago taxonomy.php 10 years ago used-by-menu.php 10 years ago wc-placeholder.php 10 years ago
taxonomy.php
95 lines
1 <?php
2 /**
3 * Taxonomy column, displaying terms from a taxonomy for any object type (i.e. posts)
4 * supporting WordPress' native way of handling terms.
5 *
6 * @since 2.0
7 */
8 class CPAC_Column_Taxonomy extends CPAC_Column {
9
10 /**
11 * @see CPAC_Column::init()
12 * @since 2.2.1
13 */
14 public function init() {
15
16 parent::init();
17
18 // Properties
19 $this->properties['type'] = 'column-taxonomy';
20 $this->properties['label'] = __( 'Taxonomy', 'codepress-admin-columns' );
21 $this->properties['is_cloneable'] = true;
22
23 // Options
24 $this->options['taxonomy'] = ''; // Taxonomy slug
25 }
26
27 /**
28 * @see CPAC_Column::get_value()
29 * @since 2.0
30 */
31 public function get_value( $post_id ) {
32 $term_ids = $this->get_raw_value( $post_id );
33 return $this->get_terms_for_display( $term_ids, $this->options->taxonomy );
34 }
35
36 /**
37 * @see CPAC_Column::get_raw_value()
38 * @since 2.0.3
39 */
40 public function get_raw_value( $post_id ) {
41 return wp_get_post_terms( $post_id, $this->options->taxonomy, array( 'fields' => 'ids' ) );
42 }
43
44 /**
45 * @see CPAC_Column::get_value()
46 * @since 2.3.4
47 */
48 public function get_taxonomy() {
49 return $this->options->taxonomy;
50 }
51
52 /**
53 * @see CPAC_Column::apply_conditional()
54 * @since 2.0
55 */
56 public function apply_conditional() {
57 $post_type = $this->get_post_type();
58 if ( ! $post_type || ! get_object_taxonomies( $post_type ) ) {
59 return false;
60 }
61
62 return true;
63 }
64
65 /**
66 * Display Settings
67 *
68 * @see CPAC_Column::display_settings()
69 * @since 2.0
70 */
71 public function display_settings() {
72
73 $taxonomies = get_object_taxonomies( $this->get_post_type(), 'objects' );
74
75 foreach ( $taxonomies as $index => $taxonomy ) {
76 if ( $taxonomy->name == 'post_format' ) {
77 unset( $taxonomies[ $index ] );
78 }
79 }
80 ?>
81
82 <tr class="column_taxonomy">
83 <?php $this->label_view( __( "Taxonomy", 'codepress-admin-columns' ), '', 'taxonomy' ); ?>
84 <td class="input">
85 <select name="<?php $this->attr_name( 'taxonomy' ); ?>" id="<?php $this->attr_id( 'taxonomy' ); ?>">
86 <?php foreach ( $taxonomies as $taxonomy ) : ?>
87 <option value="<?php echo $taxonomy->name; ?>"<?php selected( $taxonomy->name, $this->options->taxonomy ) ?>><?php echo $taxonomy->label; ?></option>
88 <?php endforeach; ?>
89 </select>
90 </td>
91 </tr>
92
93 <?php
94 }
95 }