__( 'Show posts selected category', 'supermag' ), ) ); } /*Widget Backend*/ public function form( $instance ) { if ( isset( $instance[ 'supermag_cat' ] ) ) { $supermag_selected_cat = $instance[ 'supermag_cat' ]; } else { $supermag_selected_cat = 0; } if ( isset( $instance[ 'supermag_enable_first_featured' ] ) && 1 == $instance[ 'supermag_enable_first_featured' ] ) { $supermag_enable_first_featured = 1; } else { $supermag_enable_first_featured = 0; } /*Layout options*/ $supermag_layout_arrays = array( __('Layout 1','supermag'), __('Layout 2','supermag') ); if( isset( $instance['supermag_post_col_layout'] )){ $supermag_post_col_layout = $instance['supermag_post_col_layout']; } else{ $supermag_post_col_layout = 0; } ?>
__('From Recent Posts','supermag'), 'orderby' => 'name', 'order' => 'asc', 'show_count' => 1, 'hide_empty' => 1, 'echo' => 1, 'selected' => $supermag_selected_cat, 'hierarchical' => 1, 'name' => $this->get_field_name('supermag_cat'), 'id' => $this->get_field_name('supermag_cat'), 'class' => 'widefat', 'taxonomy' => 'category', 'hide_if_empty' => false, ); wp_dropdown_categories($supermag_dropown_cat); ?>
/>
$supermag_number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ); if( -1 != $supermag_cat ){ $supermag_cat_post_args['cat'] = $supermag_cat; $supermag_title = get_cat_name($supermag_cat); } else{ $supermag_title = __('Recent Posts','supermag'); } $supermag_featured_query = new WP_Query($supermag_cat_post_args); if ($supermag_featured_query->have_posts()) : ?> "; // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); endif; } } // Class supermag_posts_col ends here } if ( ! function_exists( 'supermag_posts_col' ) ) : /** * Function to Register and load the widget * * @since 1.0.0 * * @param null * @return null * */ function supermag_posts_col() { register_widget( 'supermag_posts_col' ); } endif; add_action( 'widgets_init', 'supermag_posts_col' );