function get_trending_posts($args = array())
{
    global $post, $exclude_posts;
    $defaults = array('tags' => '', 'trending_logo' => '', 'list_post_title' => 'Top Headlines');
    // merge arguments with defaults && set keys as variables
    $args = array_merge($defaults, $args);
    foreach ($args as $key => $val) {
        ${$key} = $val;
    }
    if ($trending_logo) {
        ?>

		<div class="col-xs-12">
			<div class="trending-topic"><img src="<?php 
        echo $trending_logo;
        ?>
"/></div>
		</div>

		<?php 
    }
    $args = array('posts_per_page' => 6, 'post_status' => 'publish', 'post__not_in' => $exclude_posts, 'post_type' => 'post', 'tag' => $tags, 'orderby' => 'date', 'order' => 'DESC');
    $query = new WP_Query();
    $network_query = $query->posts = network_query_posts($args);
    $post_count = $query->post_count = count($network_query);
    $i = 1;
    while ($query->have_posts()) {
        $query->the_post();
        $blogID = $post->BLOG_ID;
        if ($i == 1) {
            ?>

			<div class="col-lg-8 col-md-12">
				<?php 
            trending_post($blogID);
            ?>
			</div>

			<?php 
        }
        if ($i == 2) {
            ?>

			<div class="col-lg-4 col-md-12">
				<div class="row">
					<div class="col-lg-12 col-md-6">
						<?php 
            classic_post($blogID);
            ?>
					</div>

					<?php 
            // just in case there are only posts
            if ($i == $post_count) {
                echo '</div></div>';
            }
        }
        if ($i == 3) {
            ?>
					<div class="col-lg-12 col-md-6">

						<div class="headline-list">
							<h4><?php 
            echo $list_post_title;
            ?>
</h4>
							<ul>
								<?php 
        }
        if ($i >= 3 && $i <= 6) {
            echo '<li>';
            echo list_post($blogID);
            echo '</li>';
        }
        if ($i == 6 || $i == $post_count) {
            ?>
							</ul>
						</div>
					</div>
				</div>
			</div>
			<?php 
            break;
            // so no additional loops once we run out of posts!
        }
        $i++;
    }
    wp_reset_query();
    reset_blog();
}
function get_standard_posts(array $args)
{
    global $exclude_posts;
    global $query_string;
    $defaults = array('category' => 0, 'author' => 0, 'offset' => 0, 's' => '', 'full_offset' => 1, 'show_ads' => 0);
    // merge arguments with defaults
    $args = array_merge($defaults, $args);
    foreach ($args as $key => $val) {
        ${$key} = $val;
        // set up each key as a variable
    }
    $search_query = array();
    $cat_object = get_category_by_slug('featured');
    $featured_cat = $cat_object->term_id;
    $ad_count = 0;
    if ($show_ads == 1) {
        $ads = get_standard_ads();
        $ad_count = count($ads);
    }
    if ($show_ads == 1 && $ad_count > 0) {
        $i = 1;
        // first post
        echo '<div class="row">';
        echo '<div class="col-sm-8 standard-post">';
        if ($show_ads == 1 && array_key_exists($i, $ads)) {
            echo standard_ad($ads[$i]);
        } else {
            $featured_args = array('posts_per_page' => 1, 'cat' => $featured_cat, 'post_status' => 'publish', 'post__not_in' => $exclude_posts, 'post_type' => 'post');
            $featured_query = new WP_Query($featured_args);
            while ($featured_query->have_posts()) {
                $featured_query->the_post();
                echo spotlight_post();
            }
            $full_offset++;
            // increase offset counter
        }
        echo '</div>';
        $i++;
        // move to post #2
        $posts_per_page = 5;
        if ($show_ads == 1) {
            $posts_per_page = posts_to_query_after_ads(array(2, 3, 4, 5, 6), $ads);
            // spots 2 - 6
        }
        $x = $i;
        while ($i < 6) {
            // (2 - 6)
            if ($show_ads == 1) {
                check_ads($i, $ads);
                // check and display ads
            }
            if ($posts_per_page > 0) {
                // if there is more than just ads
                $args = array('posts_per_page' => $posts_per_page, 'cat' => $category . ', -' . $featured_cat, 'post_status' => 'publish', 'offset' => $offset, 'author' => $author, 'post_type' => 'post', 'post__not_in' => $exclude_posts);
                $post_query = new WP_Query($args);
                while ($post_query->have_posts()) {
                    $post_query->the_post();
                    echo '<div class="col-sm-4 standard-post">';
                    echo classic_post();
                    echo '</div>';
                    $i++;
                    if ($show_ads == 1) {
                        check_ads($i, $ads);
                        // check and display ads
                    }
                }
            }
            if ($x == $i) {
                return;
            }
        }
        // i should == 7
        echo '<div class="col-sm-8 standard-post">';
        if ($show_ads == 1 && array_key_exists($i, $ads)) {
            echo standard_ad($ads[$i]);
        } else {
            $featured_args = array('posts_per_page' => 1, 'cat' => $featured_cat, 'post_type' => 'post', 'post_status' => 'publish', 'post__not_in' => $exclude_posts);
            $featured_query = new WP_Query($featured_args);
            while ($featured_query->have_posts()) {
                $featured_query->the_post();
                echo spotlight_post();
            }
            $full_offset++;
            // increase offset counter
        }
        echo '</div>';
        $i++;
        // move to post #2
        $posts_per_page = 3;
        if ($show_ads == 1) {
            $posts_per_page = posts_to_query_after_ads(array(8, 9, 10), $ads);
            // spots 2 - 6
        }
        $x = $i;
        while ($i < 11) {
            // (2 - 6)
            if ($show_ads == 1) {
                check_ads($i, $ads);
                // check and display ads
            }
            if ($posts_per_page > 0) {
                // if there is more than just ads
                $args = array('posts_per_page' => $posts_per_page, 'cat' => '-' . $featured_cat, 'post_status' => 'publish', 'offset' => $offset, 'post_type' => 'post', 'author' => $author, 'post__not_in' => $exclude_posts);
                $post_query = new WP_Query($args);
                while ($post_query->have_posts()) {
                    $post_query->the_post();
                    echo '<div class="col-sm-4 standard-post">';
                    echo classic_post();
                    echo '</div>';
                    $i++;
                    if ($show_ads == 1) {
                        check_ads($i, $ads);
                        // check and display ads
                    }
                }
            }
            if ($x == $i) {
                return;
            }
        }
        if ($i > 1) {
            echo '</div>';
        }
        if ($i == 1) {
            echo 'That is all!';
        }
        return;
    }
    // IF THERE ARE NO ADS: this loop is smaller amd faster
    $i = $x = 1;
    // x is used to determine if there are posts
    echo '<div class="row">';
    $posts_per_page = 8;
    // show 8 posts as default
    $category__and = array();
    if ($category == 0) {
        $category__and == array($featured_cat);
    } else {
        $category__and == array($category, $featured_cat);
    }
    // i == 1;
    $featured_args = array('posts_per_page' => 2, 'category__and' => $category__and, 's' => $s, 'post_status' => 'publish', 'post_type' => 'post', 'post__not_in' => $exclude_posts);
    $featured_args = array_merge($search_query, $featured_args);
    // merge potential search
    $featured_query = new WP_Query($featured_args);
    if (!$featured_query->have_posts()) {
        $posts_per_page = 12;
    }
    // if there are no posts, show 12 classic
    while ($featured_query->have_posts()) {
        $featured_query->the_post();
        echo '<div class="col-sm-8 standard-post">';
        echo spotlight_post();
        echo '</div>';
        $x++;
        if ($featured_query->current_post + 1 >= $featured_query->post_count) {
            $posts_per_page = 10;
        }
        // if there is not another featured post, show 10 classic
        break;
    }
    //$full_offset++; // increase offset counter
    $i++;
    $args = array('posts_per_page' => $posts_per_page, 'cat' => $category . ', -' . $featured_cat, 'post_status' => 'publish', 'offset' => $offset, 's' => $s, 'post_type' => 'post', 'author' => $author, 'post__not_in' => $exclude_posts);
    $args = array_merge($search_query, $args);
    // merge potential search
    $post_query = new WP_Query($args);
    while ($post_query->have_posts()) {
        $post_query->the_post();
        echo '<div class="col-sm-4 standard-post">';
        echo classic_post();
        echo '</div>';
        $x++;
        $i++;
        if ($i == 7 && $posts_per_page == 8) {
            $featured_args = array('posts_per_page' => 1, 'category__and' => $category__and, 'post_status' => 'publish', 's' => $s, 'post_type' => 'post', 'post__not_in' => $exclude_posts);
            $featured_args = array_merge($search_query, $featured_args);
            // merge potential search
            $featured_query = new WP_Query($featured_args);
            while ($featured_query->have_posts()) {
                $featured_query->the_post();
                echo '<div class="col-sm-8 standard-post">';
                echo spotlight_post();
                echo '</div>';
            }
            $full_offset++;
            // increase offset counter
        }
    }
    echo '</div>';
    if ($x == 1) {
        echo 'That is all!';
    }
}