/**
 * Display links to previous and next post, from a single post.
 *
 * @since 1.5.1
 *
 * @return null Return early if not a post.
 */
function msdlab_prev_next_post_nav()
{
    if (!is_singular() || is_page()) {
        return;
    }
    $in_same_term = false;
    $excluded_terms = false;
    $previous_post_link = get_previous_post_link('« %link', '%title', $in_same_term, $excluded_terms, 'category');
    $next_post_link = get_next_post_link('%link »', '%title', $in_same_term, $excluded_terms, 'category');
    if (is_cpt('project')) {
        $taxonomy = 'project_type';
        $prev_post = get_adjacent_post($in_same_term, $excluded_terms, true, $taxonomy);
        $next_post = get_adjacent_post($in_same_term, $excluded_terms, false, $taxonomy);
        $size = 'nav-post-thumb';
        $previous_post_link = $prev_post ? '<a href="' . get_post_permalink($prev_post->ID) . '" style="background-image:url(' . msdlab_get_thumbnail_url($prev_post->ID, $size) . '")><span class="nav-title"><i class="fa fa-angle-double-left"></i> ' . $prev_post->post_title . '</span></a>' : '<div href="' . get_post_permalink($post->ID) . '" style="opacity: 0.5;background-image:url(' . msdlab_get_thumbnail_url($post->ID, $size) . '")><span class="nav-title">You are at the beginning of the portfolio.</span></div>';
        $next_post_link = $next_post ? '<a href="' . get_post_permalink($next_post->ID) . '" style="background-image:url(' . msdlab_get_thumbnail_url($next_post->ID, $size) . '")><span class="nav-title">' . $next_post->post_title . ' <i class="fa fa-angle-double-right"></i></span></a>' : '<div href="' . get_post_permalink($post->ID) . '" style="opacity: 0.5;background-image:url(' . msdlab_get_thumbnail_url($post->ID, $size) . '")><span class="nav-title">You are at the end of the portfolio.</span></div>';
    }
    genesis_markup(array('html5' => '<div %s>', 'xhtml' => '<div class="navigation">', 'context' => 'adjacent-entry-pagination'));
    echo '<div class="pagination-previous pull-left col-xs-6">';
    echo $previous_post_link;
    echo '</div>';
    echo '<div class="pagination-next pull-right col-xs-6">';
    echo $next_post_link;
    echo '</div>';
    echo '</div>';
}
 function get_involved($atts)
 {
     global $date_info;
     extract(shortcode_atts(array('months' => '120', 'number_posts' => 4, 'display' => 'grid'), $atts));
     $args = array('posts_per_page' => $number_posts, 'post_type' => $this->cpt, 'order_by' => 'id', 'order' => 'DEC');
     //ts_data($args);
     $involveds = get_posts($args);
     //ts_data($involveds);
     $i = 0;
     foreach ($involveds as $up) {
         $date_info->the_meta($up->ID);
         if ($date_info->get_the_value('involved_start_date') && $date_info->get_the_value('involved_end_date')) {
             if ($date_info->get_the_value('involved_start_datestamp') == $date_info->get_the_value('involved_end_datestamp')) {
                 $involveds[$i]->involved_date = date("M d, Y", $date_info->get_the_value('involved_end_datestamp'));
             } else {
                 $involveds[$i]->involved_date = date("M d, Y", $date_info->get_the_value('involved_start_datestamp')) . '<br />to<br />' . date("M d, Y", $date_info->get_the_value('involved_end_datestamp'));
             }
         } elseif ($date_info->get_the_value('involved_start_date')) {
             $involveds[$i]->involved_date = date("M d, Y", $date_info->get_the_value('involved_start_datestamp'));
         } elseif ($date_info->get_the_value('involved_end_date')) {
             $involveds[$i]->involved_date = date("M d, Y", $date_info->get_the_value('involved_end_datestamp'));
         } else {
             $involveds[$i]->involved_date = '';
         }
         if ($date_info->get_the_value('involved_start_time') != '' && $date_info->get_the_value('involved_end_time') != '') {
             if ($date_info->get_the_value('involved_start_time') == $date_info->get_the_value('involved_end_time')) {
                 $involveds[$i]->involved_date .= '<br />' . $date_info->get_the_value('involved_end_time');
             } else {
                 $involveds[$i]->involved_date .= '<br />' . $date_info->get_the_value('involved_start_time') . ' to ' . $date_info->get_the_value('involved_end_time');
             }
         } elseif ($date_info->get_the_value('involved_start_time') != '') {
             $involveds[$i]->involved_date .= '<br />' . $date_info->get_the_value('involved_start_time');
         } elseif ($date_info->get_the_value('involved_end_time') != '') {
             $involveds[$i]->involved_date .= '<br />' . $date_info->get_the_value('involved_end_time');
         } else {
             $involveds[$i]->involved_date .= '';
         }
         $involveds[$i]->involved_date_start = $date_info->get_the_value('involved_start_date') ? $date_info->get_the_value('involved_start_datestamp') : 1609372800;
         $involveds[$i]->involved_date_end = $date_info->get_the_value('involved_end_date') ? $date_info->get_the_value('involved_end_datestamp') : 1609372800;
         $involveds[$i]->url = $date_info->get_the_value('involved_url');
         $involveds[$i]->hover = $date_info->get_the_value('involved_hover_color');
         $involveds[$i]->hover_img = $date_info->get_the_value('involved_hover_image');
         $involveds[$i]->title = $up->post_title;
         $i++;
     }
     $ret = '<div class="msdlab_upcoming_involveds grid row">';
     if (!empty($involveds)) {
         if ($display == 'carousel') {
             $ret .= '
         <div data-ride="carousel" class="msd_upcoming_involved_list carousel slide" id="msdUpcomingEventCarousel">
         <h3 class="pull-left">Upcoming Events:</h3>
         <div class="carousel-controls">
          <a data-slide="prev" role="button" href="#msdUpcomingEventCarousel" class="left carousel-control">
     <span aria-hidden="true" class="fa fa-arrow-circle-o-left"></span>
     <span class="sr-only">Previous</span>
   </a>
   <a data-slide="next" role="button" href="#msdUpcomingEventCarousel" class="right carousel-control">
     <span aria-hidden="true" class="fa fa-arrow-circle-o-right"></span>
     <span class="sr-only">Next</span>
   </a>
   </div>
   <div role="listbox" class="carousel-inner">
             ';
             $i = 0;
             foreach ($involveds as $involved) {
                 $active = $i == 0 ? ' active' : '';
                 $ret .= '
         <div class="item' . $active . '" id="involved_' . $involved->ID . '">
             <div class="involved-title">' . $involved->title . '</div>
             <div class="involved-date">' . date("M d, Y", $involved->involved_date) . '</div>
        </div>';
                 $i++;
             }
             $ret .= '
             </div>
             <a href="' . get_post_type_archive_link($this->cpt) . '" class="pull-right">View All Events</a>
             </div>';
         } else {
             //$display == carousel
             foreach ($involveds as $key => $involved) {
                 $overlay_img = '';
                 if ($involved->hover_img != '') {
                     $overlay_img = 'background-image: url(' . $involved->hover_img . ');';
                 }
                 $bkg = get_post_thumbnail_id($involved->ID) != '' ? 'style="background-image: url(' . msdlab_get_thumbnail_url($involved->ID, 'small-square') . ')"' : '';
                 $ret .= '
             <div class="item item-' . $key . ' grid-item col-sm-6" id="involved_' . $involved->ID . '">
                 <a href="' . $involved->url . '" class="link" ' . $bkg . '>
                 <div class="overlay" style="background-color: ' . $involved->hover . ';' . $overlay_img . '">
                     &nbsp;
                 </div>
                 <div class="wrapper">
                     <div class="involved-title">' . $involved->title . '</div>
                     <i class="fa fa-angle-right"></i>
                 </div>
                 </a>
            </div>';
             }
         }
         //$display == carousel
     } else {
         $ret .= '<p>No Get Involved</p>';
     }
     $ret .= '</div>';
     return $ret;
 }