PluginProbe
WP Ultimate Post Grid / 2.6.0
WP Ultimate Post Grid v2.6.0
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 / layout / rows.php

rows.php in WP Ultimate Post Grid 2.6.0, at addons/custom-templates/templates/layout/rows.php

57 lines 1.6 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_Rows extends WPUPG_Template_Block {
4
5 public $rows;
6 public $heights;
7
8 public $editorField = 'rows';
9
10 public function __construct( $type = 'rows' )
11 {
12 parent::__construct( $type );
13 }
14
15 public function rows( $rows )
16 {
17 $this->rows = $rows;
18 return $this;
19 }
20
21 public function height( $heights )
22 {
23 $this->heights = $heights;
24 foreach( $heights as $row => $height )
25 {
26 $this->add_style( 'height', $height, 'row-' . $row );
27 }
28 return $this;
29 }
30
31 public function output( $post, $args = array() )
32 {
33 if( !$this->output_block( $post, $args ) ) return '';
34
35 $args['max_width'] = $this->max_width && $args['max_width'] > $this->max_width ? $this->max_width : $args['max_width'];
36 $args['max_height'] = $this->max_height && $args['max_height'] > $this->max_height ? $this->max_height : $args['max_height'];
37 $args['desktop'] = $args['desktop'] && $this->show_on_desktop;
38 $output = $this->before_output();
39
40 ob_start();
41 ?>
42 <div<?php echo $this->style(); ?>>
43 <?php for( $i = 0; $i < $this->rows; $i++ ) { ?>
44 <?php if( $this->show( $post, 'row-' . $i, $args ) ) { ?>
45 <div class="wpupg-rows-row"<?php echo $this->style( 'row-' . $i ); ?>>
46 <?php $this->output_children( $post, $i, 0, $args ); ?>
47 </div>
48 <?php } // end if show row ?>
49 <?php } // end for rows ?>
50 </div>
51 <?php
52 $output .= ob_get_contents();
53 ob_end_clean();
54
55 return $this->after_output( $output, $post );
56 }
57 }