'kp-article-list-widget', 'description' => __('Article list widget', 'ad-mag-lite')); $control_ops = array('width' => 'auto', 'height' => 'auto'); parent::__construct('Ad_Mag_Lite_Articles_List', __('(AdMag) Article List', 'ad-mag-lite'), $widget_ops, $control_ops); } function widget($args, $instance) { extract( $args ); $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); $style = $instance['style']; $limit = $instance['excerpt_length']; $url = $instance['url']; $query_args = array( 'post_type' => 'post', 'posts_per_page' => $instance['number'], 'order' => $instance['order'] == 'ASC' ? 'ASC' : 'DESC', 'orderby' => $instance['orderby'] ); if(empty($instance['categories'])){ $query_args['ignore_sticky_posts'] = true; } if ( $instance['categories'] ) { $query_args['tax_query'][] = array( 'taxonomy' => 'category', 'field' => 'term_id', 'terms' => $instance['categories'], ); } if ( $instance['tags'] ) { $query_args['tax_query'][] = array( 'taxonomy' => 'post_tag', 'field' => 'term_id', 'terms' => $instance['tags'], ); } if ( isset( $query_args['tax_query'] ) && count( $query_args['tax_query'] ) === 2 ) { $query_args['tax_query']['relation'] = $instance['relation']; } $article = new WP_Query( $query_args ); $num_post = count($article->posts); ?>

have_posts()) : while($article->have_posts()) : $article->the_post(); ?> '; $next = false; } ?>
  • '; if(!empty($url)){ echo ''.__('view more', 'ad-mag-lite').''; } echo ''; } } $count++; $stt++; ?>

    have_posts()) : while($article->have_posts()) : $article->the_post(); ?>

    post_excerpt, $post->post_content, $limit); ?>

    '; $next = false; } ?>
  • '; } } $count++; ?>

    have_posts()) : while($article->have_posts()) : $article->the_post(); ?>

    post_excerpt, $post->post_content, $limit); ?>

    '; $next = false; } ?>
  • post_excerpt, $post->post_content, $limit); ?>

  • '; } } $count++; ?>

    have_posts()) : while($article->have_posts()) : $article->the_post(); ?> '; $next = false; } ?>
  • '; } } $count++; ?>

    have_posts()) : while($article->have_posts()) : $article->the_post(); ?>

    '; $next = false; } ?>
  • '; } } $count++; ?>

    have_posts()) : while($article->have_posts()) : $article->the_post(); ?> '; $next = false; } ?>
  • '; } } $count++; ?>

    have_posts()) : while($article->have_posts()) : $article->the_post(); $icon = get_post_format(); ?>

    '; $next = false; } ?>
  • post_excerpt, $post->post_content, $limit); ?>

  • '; } } $count++; ?>
    '', 'categories' => array(), 'relation' => 'OR', 'tags' => array(), 'order' => 'DESC', 'orderby' => 'rand', 'number' => 5, 'posts_per_page' => 4, 'excerpt_length' => 10, 'style' => 'style_1', 'url' => '#', ); $instance = wp_parse_args((array) $instance, $default); $title = strip_tags($instance['title']); $form['categories'] = $instance['categories']; $form['relation'] = esc_attr($instance['relation']); $form['tags'] = $instance['tags']; $form['order'] = $instance['order']; $form['orderby'] = $instance['orderby']; $form['number'] = (int)$instance['number']; $form['excerpt_length'] = (int)$instance['excerpt_length']; $form['style'] = $instance['style']; $form['posts_per_page'] = $instance['posts_per_page']; $form['url'] = $instance['url']; ?>