__( '1', 'read-more' ), 2 => __( '2', 'read-more' ), 3 => __( '3', 'read-more' ), 4 => __( '4', 'read-more' ), 5 => __( '5', 'read-more' ), ); return apply_filters( 'read_more_post_number', $read_more_post_number ); } endif; /** * Custom columns of category with various options * * @package Acme Themes * @subpackage Read More */ if ( ! class_exists( 'Read_More_posts_col' ) ) { /** * Class for adding widget * * @package Acme Themes * @subpackage Read_More_posts_col * @since 1.0.0 */ class Read_More_posts_col extends WP_Widget { /*defaults values for fields*/ private $defaults = array( 'title' => '', 'read_more_cat_id' => '', 'post_number' => 5, 'button_url' => '' ); function __construct() { parent::__construct( /*Base ID of your widget*/ 'read_more_posts_col', /*Widget name will appear in UI*/ __('AT Posts Column', 'read-more'), /*Widget description*/ array( 'description' => __( 'Show recent posts or posts from a category', 'read-more' ), ) ); } /*Widget Backend*/ public function form( $instance ) { $instance = wp_parse_args( (array) $instance, $this->defaults ); /*default values*/ $title = esc_attr( $instance[ 'title' ] ); $read_more_selected_cat = esc_attr( $instance[ 'read_more_cat_id' ] ); $post_number = absint( $instance[ 'post_number' ] ); $button_url = esc_url( $instance[ 'button_url' ] ); ?>

__('From Recent Posts','read-more'), 'orderby' => 'name', 'order' => 'asc', 'show_count' => 1, 'hide_empty' => 1, 'echo' => 1, 'selected' => $read_more_selected_cat, 'hierarchical' => 1, 'name' => $this->get_field_name('read_more_cat_id'), 'id' => $this->get_field_name('read_more_cat_id'), 'class' => 'widefat', 'taxonomy' => 'category', 'hide_if_empty' => false, ); wp_dropdown_categories($read_more_dropown_cat); ?>

defaults); /*default values*/ $title = apply_filters( 'widget_title', !empty( $instance['title'] ) ? $instance['title'] : '', $instance, $this->id_base ); $read_more_cat_id = esc_attr( $instance[ 'read_more_cat_id' ] ); $post_number = absint( $instance[ 'post_number' ] ); $button_url = esc_url( $instance[ 'button_url' ] ); /** * Filter the arguments for the Recent Posts widget. * * @since 1.0.0 * * @see WP_Query * */ $read_more_cat_post_args = array( 'posts_per_page' => $post_number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ); if( -1 != $read_more_cat_id ){ $read_more_cat_post_args['cat'] = $read_more_cat_id; } $the_query = new WP_Query( $read_more_cat_post_args ); echo $args['before_widget']; ?>
have_posts() ): $col = 12/$post_number; $i = 1; $i_1_end = ''; $i_2_end = ''; global $image_size_options; $image_size_options = 'post-thumbnail'; while( $the_query->have_posts() ):$the_query->the_post(); if( 'read-more-footer-full-width' == $read_more_sidebar_id || 'read-more-home' == $read_more_sidebar_id ){ if( $post_number < 5 ){ $b_col = 'col-sm-'.$col; ?>
"; $inner_content = ""; $i_1_end = "
"; $image_size_options = 'large'; } if( $i == 2 ){ echo "
"; echo "
"; $inner_content = " col-sm-6"; $i_1_end = ""; } if( $i == 4 ){ echo "
";/*row $i = 2*/ } if( $i == 5 ){ $i_2_end = "
";/*col-sm-6 $i = 2 and row $i = 4*/ } ?>