prefix = framework_get_prefix(); /* Set up the widget options. */ $widget_options = array( 'classname' => 'image-gallery', 'description' => esc_html__( 'Display your site\'s images.', 'wordsmith' ) ); /* Set up the widget control options. */ $control_options = array( 'width' => 200, 'height' => 350 ); /* Create the widget. */ $this->WP_Widget( "{$this->prefix}-image-gallery", __( 'Image Gallery', 'wordsmith' ), $widget_options, $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 a title was input by the user, display it. */ if ( !empty( $instance['title'] ) ) echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title; /* Query images. */ $loop = new WP_Query( array( 'orderby' => 'parent', 'post_mime_type' => 'image', 'posts_per_page' => intval( $instance['posts_per_page'] ), 'post_status' => 'inherit', 'post_type' => 'attachment' ) ); echo '