Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $limit = $atts['limit'] ? $atts['limit'] : 0;
- $imgWidth = $atts['imgwidth'] ? $atts['imgwidth'] : "80";
- $showImg = $atts['showimage'] == 'false' ? false : true;
- $columns = isset($atts['columns']) ? $atts['columns'] : '4';
- $args = array(
- 'cat' => $atts['category'],
- 'category_name' => $atts['slug'],
- 'tag' => $atts['tags'],
- 'post_type' => 'post',
- 'posts_per_page' => (isset($atts['limit']) ? $atts['limit'] : 6),
- 'order' => $atts['order'],
- 'orderby' => $atts['orderby']
- );
- $wp_q = new WP_Query($args);
- $ResponsiveCounter = 1;
- while($wp_q->have_posts())
- {
- $wp_q->the_post();
- $post_class = '';
- if($ResponsiveCounter == 1)
- $post_class .= ' left-fit';
- if($columns == '4')
- $post_class .= ' grid col-220';
- else if($columns == '3')
- $post_class .= ' grid col-300';
- else if($columns == '2')
- $post_class .= ' grid col-460';
- if(($columns == '2' && $ResponsiveCounter == 2) || ($columns == '3' && $ResponsiveCounter == 3) || ($columns == '4' && $ResponsiveCounter == 4)){
- $post_class .= ' fit';
- $ResponsiveCounter = 0;
- }
- echo '<div class="'.$post_class.'">';
- $id = $wp_q->post->ID;
- $myimage_html = '';
- if($atts['hidetext'] == 'true')
- echo '<li><a href="'.get_permalink($wp_q->post->ID).'">'.$wp_q->post->post_title.'</a></li>';
- else
- echo '<div id="nw_post_'.$id.'" class="plnaslov"><a href="'.get_permalink($wp_q->post->ID).'"><h4>'.$wp_q->post->post_title.'</h4></a></div>';
- if($showImg)
- $myimage_html = my_get_first_image($id);
- echo '<div class="plcontent">';
- if($myimage_html != '')
- $myimage_html .= '<br>';
- echo $myimage_html.get_the_excerpt();
- echo '</div>';
- echo '</div>';
- $ResponsiveCounter++;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement