Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - public function getWidgetContent ($instance)
 - {
 - $instance = $this->setDefalutValues( $instance );
 - $widgetContent = '';
 - $queryArgs = array('showposts' => $instance['number'], 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1);
 - if ( $instance['category'] != -1 ) {
 - $queryArgs['cat'] = $instance['category'];
 - }
 - $r = new WP_Query($queryArgs);
 - if ($r->have_posts()) {
 - while ($r->have_posts()) {
 - $r->the_post();
 - $permalink = get_permalink();
 - $postID = get_the_ID();
 - $postTitle = esc_attr( get_the_title() ? get_the_title() : $postID );
 - $postLink = sprintf('<a href="%s" title="%s" class="post-link">%s</a>', $permalink, $postTitle, $postTitle);
 - $thumbnail = '';
 - $postDate = '';
 - if ( $instance['thumbs'] == 'yes' ) {
 - $postDate = sprintf( '<span class="widget-post-meta">%s • %s</span>', get_the_author_link(), get_the_time(get_option('date_format')) );
 - }
 - if ( $instance['thumbs'] == 'yes' && has_post_thumbnail() ) {
 - $thumbnail = get_the_post_thumbnail( $postID, 'post-thumbnail-small', array('class'=>'thumbnail') );
 - $thumbnail = sprintf('<a href="%1$s" class="thumb-post-link">%2$s</a>', $permalink, $thumbnail);
 - }
 - $widgetContent .= '<li>' . $thumbnail . $postLink . $postDate . '</li>';
 - }
 - $thumbsClass = ( $instance['thumbs'] == 'yes' ) ? ' with-thumbnails' : ' no-thumb';
 - $widgetContent = sprintf('<ul class="mw-widget-recent-posts-list%s">%s</ul>', $thumbsClass, $widgetContent);
 - wp_reset_postdata();
 - }
 - return $widgetContent;
 - }
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment