prefix = hybrid_get_prefix(); /* Set up the widget options. */ $widget_options = array( 'classname' => 'ascetica-thumbnails-widget', 'description' => esc_html__( 'Display post images from selected category.', 'ascetica' ) ); /* Set up the widget control options. */ $control_options = array( 'width' => 300, 'height' => 350 ); /* Create the widget. */ $this->WP_Widget( 'ascetica-thumbnails-widget', // $this->id_base __( 'Ascetica - Thumbnails', 'ascetica' ), // $this->name $widget_options, // $this->widget_options $control_options // $this->control_options ); } /* Outputs the widget based on the arguments input through the widget controls. */ function widget( $args, $instance ) { extract( $args ); /* Output the theme's $before_widget wrapper. */ echo $before_widget; if ( !empty( $instance['title'] ) ) echo $before_title . apply_filters( 'widget_title', esc_html( $instance['title'] ), $instance, $this->id_base ) . $after_title; $maxitems = $instance['thumbnails_count']; ?>
  • $instance['thumbnails_cat'], 'orderby' => !empty( $instance['thumbnails_randomize']) ? 'rand' : '', 'posts_per_page' => $instance['thumbnails_count'] ); $loop = new WP_Query( $args ); $thumbcounter = 1; if ( $loop->have_posts() ) : ?> esc_attr__( 'Thumbnails', 'ascetica' ), 'thumbnails_cat' => 1, 'thumbnails_count' => 4, 'thumbnails_randomize' => '' ); /* Merge the user-selected arguments with the defaults. */ $instance = wp_parse_args( (array) $instance, $defaults ); ?>