PluginProbe
WP Ultimate Post Grid / 1.7.2
WP Ultimate Post Grid v1.7.2
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / addons / custom-templates / templates / post / taxonomy_terms.php

taxonomy_terms.php in WP Ultimate Post Grid 1.7.2, at addons/custom-templates/templates/post/taxonomy_terms.php

45 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class WPUPG_Template_Post_Taxonomy_Terms extends WPUPG_Template_Block {
4
5 public $taxonomy;
6 public $separator;
7 public $editorField = 'postTaxonomyTerms';
8
9 public function __construct( $type = 'post-taxonomy-terms' )
10 {
11 parent::__construct( $type );
12 }
13
14 public function taxonomy( $taxonomy )
15 {
16 $this->taxonomy = $taxonomy;
17 return $this;
18 }
19
20 public function separator( $separator )
21 {
22 $this->separator = $separator;
23 return $this;
24 }
25
26 public function output( $post, $args = array() )
27 {
28 if( !$this->output_block( $post, $args ) ) return '';
29
30 $taxonomy = explode( ';', $this->taxonomy );
31 $taxonomy_terms = wp_get_post_terms( $post->ID, $taxonomy );
32
33 $terms = array();
34 foreach( $taxonomy_terms as $term ) {
35 $terms[] = $term->name;
36 }
37 $terms = implode( $this->separator, $terms );
38
39 $output = $this->before_output();
40
41 $output .= '<span' . $this->style() . '>' . $terms . '</span>';
42
43 return $this->after_output( $output, $post );
44 }
45 }