__('A widget that shows latest review posts', 'accesspress-mag') ) ); } /** * Helper function that holds widget fields * Array is used in update and form functions */ private function widget_fields() { $fields = array( 'latest_review_post_title' => array( 'accesspress_mag_widgets_name' => 'latest_review_post_title', 'accesspress_mag_widgets_title' => __('Title', 'accesspress-mag'), 'accesspress_mag_widgets_field_type' => 'title', ), ); return $fields; } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { extract($args); $latest_review_posts_title = $instance['latest_review_post_title']; echo $before_widget; ?>
'; // print_r($review_array); // echo ''; $p_count = 0; if($review_array->have_posts()){ while($review_array->have_posts()){ $review_array->the_post(); $p_count++; $review_image_id = get_post_thumbnail_id(); $review_big_image_path = wp_get_attachment_image_src($review_image_id,'block-big-thumb',true); $review_small_image_path = wp_get_attachment_image_src($review_image_id,'block-small-thumb',true); $review_image_alt = get_post_meta($review_image_id,'_wp_attachment_image_alt',true); if($p_count==1): ?>