Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- WIDGET 1 query args
- widget will be added to theme by include('mywidget.php') in functions.php file
- */
- $featured_posts = new WP_Query(array(
- 'posts_per_page' => 3,
- 'category_name' => 'featured',
- ));
- $count = 1;
- ?>
- <ul id="featured_posts" class="clearfix">
- <?php
- global $do_not_duplicate;
- global $post;
- while($featured_posts->have_posts()): $featured_posts->the_post(); $do_not_duplicate[] = $post->ID;
- if($count == 1): ?>
- <!-- first featured post markup -->
- <?php else : ?>
- <!-- next two featured posts markup -->
- <?php endif; ?>
- <?php $count++; endwhile; ?>
- <?php wp_reset_postdata(); wp_reset_query(); ?>
- </ul>
- <?php
- /**
- WIDGET 2 query args
- widget will be added to theme by include('mywidget.php') in functions.php file
- */
- $categoryblock_posts = new WP_Query(array(
- 'posts_per_page' => 5,
- 'cat' => $cat_id,
- 'category__not_in' => 9
- ));
- $count = 1;
- ?>
- <ul class="blog-list clearfix">
- <?php
- global $do_not_duplicate;
- while($categoryblock_posts->have_posts()): $categoryblock_posts->the_post(); $do_not_duplicate[] = $post->ID;
- if($count == 1): ?>
- <!-- first featured post markup -->
- <?php else : ?>
- <!-- next two featured posts markup -->
- <?php endif; ?>
- <?php $count++; endwhile; ?>
- <?php wp_reset_postdata(); wp_reset_query(); ?>
- </ul>
- <?php
- /**
- main loop on index.php
- */
- <?php if ( have_posts() ) : ?>
- <?php get_sidebar('contentwidgets'); ?>
- <ul>
- <?php
- global $do_not_duplicate;
- $count = 1;
- while(have_posts()): the_post();
- if($post->ID == $do_not_duplicate) continue;
- if($count == 1) :
- echo '<li class="col8 first clearfix">';
- get_template_part('content');
- echo '</li>';
- echo '<li id="infobox" class="col4-5 clearfix">';
- get_template_part('content', 'infobox');
- echo '</li>';
- else :
- echo '<li class="clearfix">';
- get_template_part('content');
- echo '</li>';
- endif;
- $count++; endwhile;
- wp_reset_query(); wp_reset_postdata(); v?>
- </ul>
- <?php endif; ?>
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement