/** * PHP5 constructor. * * @since 1.0.0 */ public function __construct() { parent::__construct($this->get_widget_slug(), __('Cherry Testimonials', 'cherry-testimonials'), array('classname' => $this->get_widget_slug(), 'description' => __("Your site's most recent Testimonials.", 'cherry-testimonials'))); $this->data = Cherry_Testimonials_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() { 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 allow it process testimonials. 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_Testimonials_Data::get_instance(); }