PluginProbe
WP Ultimate Post Grid / 4.1.1
WP Ultimate Post Grid v4.1.1
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 / includes / public / shortcodes / item / class-wpupg-sc-content.php

class-wpupg-sc-content.php in WP Ultimate Post Grid 4.1.1, at includes/public/shortcodes/item/class-wpupg-sc-content.php

58 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Handle the item content shortcode.
4 *
5 * @link https://bootstrapped.ventures
6 * @since 3.0.0
7 *
8 * @package WP_Ultimate_Post_Grid
9 * @subpackage WP_Ultimate_Post_Grid/includes/public/shortcodes/item
10 */
11
12 /**
13 * Handle the item content shortcode.
14 *
15 * @since 3.0.0
16 * @package WP_Ultimate_Post_Grid
17 * @subpackage WP_Ultimate_Post_Grid/includes/public/shortcodes/item
18 * @author Brecht Vandersmissen <brecht@bootstrapped.ventures>
19 */
20 class WPUPG_SC_Content extends WPUPG_Template_Shortcode {
21 public static $shortcode = 'wpupg-item-content';
22
23 public static function init() {
24 $atts = WPUPG_Template_Helper::limit_text_atts();
25
26 self::$attributes = $atts;
27 parent::init();
28 }
29
30 /**
31 * Output for the shortcode.
32 *
33 * @since 3.0.0
34 * @param array $atts Options passed along with the shortcode.
35 */
36 public static function shortcode( $atts ) {
37 $atts = parent::get_attributes( $atts );
38
39 $item = WPUPG_Template_Shortcodes::get_item();
40 if ( ! $item ) {
41 return '';
42 }
43
44 // Output.
45 $classes = array(
46 'wpupg-item-content',
47 );
48
49 // Parse content before limitting.
50 $content = apply_filters( 'the_content', $item->content() );
51
52 $text = WPUPG_Template_Helper::limit_text( $atts, $content );
53 $output = '<div class="' . esc_attr( implode( ' ', $classes ) ) . '">' . $text . '</div>';
54 return apply_filters( parent::get_hook(), $output, $atts, $item );
55 }
56 }
57
58 WPUPG_SC_Content::init();