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 / custom_field.php

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

31 lines 786 B
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_Custom_Field extends WPUPG_Template_Block {
4
5 public $editorField = 'postCustomField';
6 public $key;
7
8 public function __construct( $type = 'custom-field' )
9 {
10 parent::__construct( $type );
11 }
12
13 public function key( $key )
14 {
15 $this->key = $key;
16 return $this;
17 }
18
19 public function output( $post, $args = array() )
20 {
21 if( !$this->output_block( $post, $args ) ) return '';
22
23 $output = $this->before_output();
24
25 if( !$this->key || !get_post_meta( $post->ID, $this->key, true ) ) return '';
26
27 $output .= '<span' . $this->style() . '>' . $this->cut_off( get_post_meta( $post->ID, $this->key, true ) ) . '</span>';
28
29 return $this->after_output( $output, $post );
30 }
31 }