/** * Constructor for the class */ public function __construct() { parent::__construct($this->get_widget_slug(), __('Cherry Team', 'cherry-team'), array('classname' => $this->get_widget_slug(), 'description' => __("Your site's most recent Team.", 'cherry-team'))); $this->data = Cherry_Team_Data::get_instance(); // Refreshing the widget's cached output with each new post. add_action('save_post', array($this, 'flush_widget_cache')); add_action('deleted_post', array($this, 'flush_widget_cache')); add_action('switch_theme', array($this, 'flush_widget_cache')); }
/** * Sets up our actions/filters. * * @since 1.0.0 */ public function __construct() { // Register shortcode on 'init'. add_action('init', array($this, 'register_shortcode')); // Register shortcode and add it to the dialog. add_filter('cherry_shortcodes/data/shortcodes', array($this, 'shortcodes')); add_filter('cherry_templater/data/shortcodes', array($this, 'shortcodes')); add_filter('cherry_templater_target_dirs', array($this, 'add_target_dir'), 11); add_filter('cherry_templater_macros_buttons', array($this, 'add_macros_buttons'), 11, 2); // Modify swiper_carousel shortcode to aloow it process team add_filter('cherry_shortcodes_add_carousel_macros', array($this, 'extend_carousel_macros')); add_filter('cherry-shortcode-swiper-carousel-postdata', array($this, 'add_carousel_data'), 10, 3); $this->data = Cherry_Team_Data::get_instance(); }
* @package Cherry_Team * @author Cherry Team * @license GPL-2.0+ * @link http://www.cherryframework.com/ * @copyright 2015 Cherry Team */ if (have_posts()) { while (have_posts()) { the_post(); ?> <article <?php if (function_exists('cherry_attr')) { cherry_attr('post'); } ?> > <?php // Display a page content. the_content(); $args = array('template' => 'default.tmpl', 'limit' => 3, 'custom_class' => 'team-listing row', 'item_class' => 'team-listing_item', 'col_xs' => '12', 'col_sm' => '6', 'col_md' => '4', 'col_lg' => false, 'container' => false, 'size' => 'thumbnail', 'pager' => true, 'limit' => Cherry_Team_Templater::get_posts_per_archive_page()); $data = new Cherry_Team_Data(); $data->the_team($args); ?> </article> <?php } }
/** * Returns the instance. * * @since 1.0.0 * @return object */ public static function get_instance() { // If the single instance hasn't been set, set it now. if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }
<?php /** * The Template for displaying single CPT Team. * */ while (have_posts()) { the_post(); ?> <article <?php if (function_exists('cherry_attr')) { cherry_attr('post'); } ?> > <?php do_action('cherry_post_before'); $args = array('id' => get_the_ID(), 'template' => 'single-team.tmpl', 'custom_class' => 'team-page-single', 'size' => 'thumbnail', 'container' => false, 'item_class' => 'team-single-item'); $data = new Cherry_Team_Data(); $data->the_team($args); $data->microdata_markup(); ?> </article> <?php do_action('cherry_post_after'); ?> <?php }