public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $posts_per_page = (int) $instance['posts_per_page']; $orderby = strip_tags($instance['orderby']); $testimonial_id = null == $instance['testimonial_id'] ? '' : strip_tags($instance['testimonial_id']); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } echo get_testimonial($posts_per_page, $orderby, $testimonial_id); echo $after_widget; }
/** * Shortcode to display testimonials * * This functions is attached to the 'testimonial' action hook. * * [testimonial posts_per_page="1" orderby="none" testimonial_id=""] */ function testimonial_shortcode($atts) { extract(shortcode_atts(array('posts_per_page' => '1', 'orderby' => 'none', 'testimonial_id' => '', 'owlc_opts' => ''), $atts)); return get_testimonial($posts_per_page, $orderby, $testimonial_id, $owlc_opts); }