'bmag_widget_5_posts_style_1', 'description' => __( 'Displays the latest 5 posts of specific category. This widget must use it ONLY on the MAGAZINE FRONT PAGE, in Mag Front Page: Below Header widget area.', 'bmag' ), ); parent::__construct( 'Bmag_Widget_5_Posts_Style_1', '(BMag) ' . __( '5 Posts - Style 1', 'bmag' ), $widget_ops ); } public function form( $instance ) { $defaults = array( 'title' => '', 'cat_sel' => '', 'frame' => 'frameless', ); $instance = wp_parse_args( (array) $instance, $defaults ); $title = $instance ['title']; $cat_sel = $instance['cat_sel']; $frame = $instance ['frame']; ?>


:


id_base ) : ''; $cat_sel = ! empty( $instance['cat_sel'] ) ? $instance['cat_sel'] : ''; $frame = ! empty( $instance['frame'] ) ? $instance['frame'] : 'frameless'; if (! empty( $title ) ) { echo $args['before_title'] . esc_html( $title ) . $args['after_title']; } $arg = array( 'posts_per_page' => 5, 'cat' => $cat_sel, ); $query = new WP_Query( $arg ); if ( $query->have_posts() ) : $num = $this->number; $np = 0; $n_row = 0; ?>
have_posts() ) : $query->the_post(); $current_post = $query->current_post; $np++; if ( $current_post == 0 ) { // Elemento principal. ?>
', '' ); ?>
0; Elementos secundarios. if ( $current_post == 1 ) { // Primer item secundario, se abre el contenedor. ?>
>
', '' ); ?>
'; // Close .wrapper-row-secondary-items-5-posts-st1 } } if ( $np == 5 ) { break; // Aunque haya sticky post solo mostramos 5 entradas. } endwhile; ?>