'bmag_widget_banner_3_posts',
'description' => __( 'Displays the latest 3 post of specific category. This widget must use it ONLY on the MAGAZINE FRONT PAGE.', 'bmag' ),
);
parent::__construct( 'Bmag_Widget_Banner_3_Posts', '(BMag) ' . __( '3 Posts', 'bmag' ), $widget_ops );
}
public function form( $instance ) {
$defaults = array(
'title' => '',
'cat_sel' => '',
'offset' => 0,
'frame' => 'frameless',
);
$instance = wp_parse_args( (array) $instance, $defaults );
$title = $instance ['title'];
$cat_sel = $instance['cat_sel'];
$offset = $instance['offset'];
$frame = $instance ['frame'];
?>
:
:
id_base ) : '';
$cat_sel = ! empty( $instance['cat_sel'] ) ? $instance['cat_sel'] : '';
$offset = ! empty( $instance['offset'] ) ? (int) $instance['offset'] : 0;
$frame = ! empty( $instance['frame'] ) ? $instance['frame'] : 'frameless';
if (! empty( $title ) ) {
echo $args['before_title'] . esc_html( $title ) . $args['after_title'];
}
$arg = array(
'post__not_in' => get_option( 'sticky_posts' ),
'posts_per_page' => 3,
'cat' => $cat_sel,
'offset' => $offset,
);
$query = new WP_Query( $arg );
if ( $query->have_posts() ) :
$num = $this->number;
?>
have_posts() ) :
$query->the_post();
?>