'bmag_widget_5_posts_style_2',
'description' => __( 'Displays the latest 5 posts of specific category. This widget must use it ONLY on the MAGAZINE FRONT PAGE.', 'bmag' ),
);
parent::__construct( 'Bmag_Widget_5_Posts_Style_2', '(BMag) ' . __( '5 Posts - Style 2', 'bmag' ), $widget_ops );
}
public function form( $instance ) {
$defaults = array(
'title' => '',
'cat_sel' => '',
'offset' => 0,
'frame' => 'light-frame',
);
$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'] : 'light-frame';
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' => 5,
'cat' => $cat_sel,
'offset' => $offset,
);
$query = new WP_Query( $arg );
if ( $query->have_posts() ) :
$num = $this->number;
?>
have_posts() ) :
$query->the_post();
$current_post = $query->current_post;
if ( 0 == $current_post ) { // Elemento principal.
?>
0. Elementos secundarios.
?>