/**
 * UCFBands Shortcode: Events
 *
 * @author Jordan Pakrosnis
 */
function ucfbands_shortcode_events($atts)
{
    //-- ATTRIBUTES --//
    $atts = shortcode_atts(array('num' => '3', 'heading' => '', 'button' => '', 'band' => 'all-bands'), $atts, 'announcements');
    //-- SET VARS --//
    // Attributes
    $events_num = $atts['num'];
    $events_heading = $atts['heading'];
    $events_button = $atts['button'];
    $events_band = $atts['band'];
    // Helpers
    $events = '';
    // WP_Query()
    $no_events_found = '';
    // Output
    $shortode_output = '';
    //=========//
    //  LOGIC  //
    //=========//
    //-- WRAP --//
    $events_wrap_open = '<div class="events-shortcode-wrap">';
    $events_wrap_close = '</div>';
    //-- HEADING --//
    // If no heading, don't do block title or button
    if ($events_heading != 'no') {
        // Block Button
        if ($events_button != 'no') {
            $events_button = ' <a class="button button-xsm button-white" href="' . get_site_url() . '/events' . '">View All</a>';
        }
        // Set Block Title
        $events_heading = '<h2 class="block-title"><i class="fa fa-calendar"></i>&nbsp;Upcoming Events' . $events_button . '</h2>';
    }
    // if announcements_heading isn't "no"
    //-- GET EVENTS --//
    $events = ucfbands_event_query($events_num, $events_band);
    // Check for posts
    $events_has_posts = $events->have_posts();
    //==========//
    //  OUTPUT  //
    //==========//
    // Wrap Open
    $shortcode_output .= $events_wrap_open;
    // Heading
    $shortcode_output .= $events_heading;
    // None Found
    if ($events_has_posts == false) {
        $shortcode_output .= ucfbands_event_none_found($events_band);
    }
    // If posts are found, process them
    if ($events_has_posts) {
        // GET EVENTS LISTING //
        $shortcode_output .= ucfbands_events_listing($events);
    }
    // if events has posts
    // Wrap Close
    $shortcode_output .= $events_wrap_close;
    // Return Output
    return $shortcode_output;
}
/**
 * Archive Masonry Grid
 *
 * @author Jordan Pakrosnis
 * @link http://ucfbands.com/
 */
function archive_masonry_grid()
{
    //-- CPT QUERY --//
    $events = ucfbands_event_query(60, 'all-bands');
    // If there's events, do the grid
    if ($events->have_posts()) {
        // MASONRY GRID CONTAINER //
        // Column Layout
        $masonry_column_layout = '6col';
        // Use Layout Option with container output
        echo '<section class="masonry-' . $masonry_column_layout . '-grid">';
        echo '<div class="masonry-' . $masonry_column_layout . '-grid-sizer"></div>';
        echo '<div class="masonry-' . $masonry_column_layout . '-gutter-sizer"></div>';
        // GET EVENTS LISTING //
        echo ucfbands_events_listing($events, true);
        // End Grid
        echo '</section>';
        // PAGINATION //
        ?>

        <!-- Pagination Container -->
        <div class="archive-pagination pagination">
            <ul>

                <!-- Previous Posts -->
                <li><?php 
        previous_posts_link('Older Events');
        ?>
</li>

                <!-- Older Announcements -->
                <li><?php 
        next_posts_link('Future Events');
        ?>
</li>

            </ul>
        </div><!-- /.archive-pagination.pagination -->

        <?php 
    }
    // if posts found
}