function timeline_load_more() { if (!wp_verify_nonce($_REQUEST['nonce'], 'timeline_load_more')) { exit('NONCE INCORRECT!'); } /************************************** GET VARS ***************************************/ //get options first $inspire_options = get_option('inspire_options'); $inspire_options_hp = get_option('inspire_options_hp'); //build vars $timeline_offset = $_REQUEST['offset']; $cmb_timeline_posts_per_page = $_REQUEST['posts_per_page']; $cmb_timeline_cat = $_REQUEST['category']; $cmb_timeline_order = $_REQUEST['order']; $exclude_string = $_REQUEST['exclude_string']; $default_excerpt_length = $_REQUEST['default_excerpt_length']; $cmb_timeline_link_through = $_REQUEST['link_through']; $cmb_timeline_display_content = $_REQUEST['display_content']; //calculate new offset $timeline_offset = $timeline_offset + $cmb_timeline_posts_per_page; /************************************** DATABASE QUERY ***************************************/ //basic args $query_args = array(); $query_args = array_merge($query_args, array('post_type' => 'post', 'post_status' => array('publish', 'future'), 'suppress_filters' => true, 'numberposts' => $cmb_timeline_posts_per_page + 1, 'offset' => $timeline_offset, 'category_name' => $cmb_timeline_cat, 'orderby' => 'post_date', 'order' => $cmb_timeline_order, 'exclude' => $exclude_string)); //final query $results_query = get_posts($query_args); /************************************** OUTPUT ***************************************/ //check if this is an ajax call and if so output if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { //copy/paste from page-timeline.php for ($i = 0; $i < count($results_query); $i++) { $this_post = $results_query[$i]; $post_format = get_post_format($this_post->ID); $cmb_excerpt = get_post_meta($this_post->ID, 'cmb_excerpt', true); $cmb_feature = get_post_meta($this_post->ID, 'cmb_feature', true); $cmb_media_link = get_post_meta($this_post->ID, 'cmb_media_link', true); $cmb_quote_is_tweet = get_post_meta($this_post->ID, 'cmb_quote_is_tweet', true); $cmb_byline = get_post_meta($this_post->ID, 'cmb_byline', true); $has_feature = mb_has_feature($this_post->ID); //STANDARD POST + VIDEO POST + AUDIO POST + NO FEAT IMG POST if ($post_format === false || $post_format === "video" || $post_format === "audio") { ?> <li id="milestone-<?php echo $timeline_offset + $i; ?> " class="milestone"> <!-- featured image --> <?php if ($cmb_feature == "media" && !empty($cmb_media_link)) { echo $cmb_media_link; } elseif ($cmb_feature == "media_in_lightbox" && !empty($cmb_media_link) && get_post(get_post_thumbnail_id($this_post->ID))) { echo '<div class="mosaic-block fade">'; $post_thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($this_post->ID), 'full'); $img_alt = get_post_meta(get_post_thumbnail_id($this_post->ID), '_wp_attachment_image_alt', true); printf('<a href="%s" class="mosaic-overlay fancybox-media fancybox.iframe play"></a>', esc_url($cmb_media_link)); printf('<div class="mosaic-backdrop"><img src="%s" alt="%s" /></div>', esc_url($post_thumbnail_src[0]), esc_attr($img_alt)); echo '</div>'; } elseif (has_post_thumbnail($this_post->ID) && get_post(get_post_thumbnail_id($this_post->ID))) { echo '<div class="mosaic-block fade">'; $post_thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($this_post->ID), 'full'); $img_alt = get_post_meta(get_post_thumbnail_id($this_post->ID), '_wp_attachment_image_alt', true); $img_post = get_post(get_post_thumbnail_id($this_post->ID)); printf('<a href="%s" class="mosaic-overlay fancybox" title="%s"></a>', esc_url($post_thumbnail_src[0]), esc_attr($img_post->post_title)); printf('<div class="mosaic-backdrop"><img src="%s" alt="%s" /></div>', esc_url($post_thumbnail_src[0]), esc_attr($img_alt)); echo '</div>'; } ?> <div class="milestone-container"> <!-- datetime --> <h6 class="time-date"><?php echo mb_localize_datetime(get_the_time(get_option('date_format'), $this_post->ID)); ?> </h6> <!-- title --> <?php if ($cmb_timeline_link_through == "checked") { printf('<h3><a href="%s">%s</a></h3>', esc_url(get_permalink($this_post->ID)), esc_attr($this_post->post_title)); } else { printf('<h3>%s</h3>', esc_attr($this_post->post_title)); } ?> <!-- excerpt/content --> <?php if ($cmb_timeline_display_content == "checked") { echo do_shortcode($this_post->post_content); } else { if (empty($cmb_excerpt)) { echo mb_make_excerpt($this_post->post_content, $default_excerpt_length, true); } else { echo do_shortcode($cmb_excerpt); } } if ($cmb_timeline_link_through == "checked") { printf('…<a class="more" href="%s">%s</a>', esc_url(get_permalink($this_post->ID)), __("more", "loc_canon")); } ?> </div> </li> <?php } //END STANDARD POST + VIDEO POST + AUDIO POST + NO FEAT IMG POST //QUOTE POST if ($post_format == "quote") { ?> <li id="milestone-<?php echo $timeline_offset + $i; ?> " class="milestone"> <div class="milestone-container"> <!-- datetime --> <h6 class="time-date"><?php echo mb_localize_datetime(get_the_time(get_option('date_format'), $this_post->ID)); ?> </h6> <!-- title --> <?php if ($cmb_timeline_link_through == "checked") { printf('<h3><a href="%s">%s</a></h3>', esc_url(get_permalink($this_post->ID)), esc_attr($this_post->post_title)); } else { printf('<h3>%s</h3>', esc_attr($this_post->post_title)); } ?> <!-- excerpt/content --> <?php if ($cmb_timeline_display_content == "checked") { if (!empty($this_post->post_content)) { echo do_shortcode($this_post->post_content); } } else { ?> <blockquote> <!-- excerpt --> <?php if (empty($cmb_excerpt)) { echo mb_make_excerpt($this_post->post_content, $default_excerpt_length, true); } else { echo do_shortcode($cmb_excerpt); } ?> <?php if (!empty($cmb_byline)) { printf('<cite>- %s</cite>', esc_attr($cmb_byline)); } ?> </blockquote> <?php } if ($cmb_timeline_link_through == "checked") { printf('<a class="more" href="%s">%s</a>', esc_url(get_permalink($this_post->ID)), __("more", "loc_canon")); } ?> </div> </li> <?php } //END QUOTE POST //GALLERY POST if ($post_format == "gallery") { // HANDLE POST SLIDER $consolidated_slider_array = array(); $cmb_post_slider_source = get_post_meta($this_post->ID, 'cmb_post_slider_source', true); $post_slider_array = mb_strip_wp_galleries_to_array($cmb_post_slider_source); $consolidated_slider_array = mb_convert_wp_galleries_array_to_consolidated_wp_gallery_array($post_slider_array); $gallery_class_array = array('fourth', 'fourth last-fold', 'fourth', 'fourth last'); $times_to_repeat = 4; ?> <li id="milestone-<?php echo $timeline_offset + $i; ?> " class="milestone"> <div class="milestone-container"> <!-- datetime --> <h6 class="time-date"><?php echo mb_localize_datetime(get_the_time(get_option('date_format'), $this_post->ID)); ?> </h6> <!-- title --> <?php if ($cmb_timeline_link_through == "checked") { printf('<h3><a href="%s">%s</a></h3>', esc_url(get_permalink($this_post->ID)), esc_attr($this_post->post_title)); } else { printf('<h3>%s</h3>', esc_attr($this_post->post_title)); } ?> <div class="clearfix gallery"> <?php if (empty($consolidated_slider_array)) { if ($has_feature) { // same as standard feature if ($cmb_feature == "media" && !empty($cmb_media_link)) { echo $cmb_media_link; } elseif ($cmb_feature == "media_in_lightbox" && !empty($cmb_media_link) && get_post(get_post_thumbnail_id($this_post->ID))) { echo '<div class="mosaic-block fade">'; $post_thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($this_post->ID), 'full'); $img_alt = get_post_meta(get_post_thumbnail_id($this_post->ID), '_wp_attachment_image_alt', true); printf('<a href="%s" class="mosaic-overlay fancybox-media fancybox.iframe play"></a>', esc_url($cmb_media_link)); printf('<div class="mosaic-backdrop"><img src="%s" alt="%s" /></div>', esc_url($post_thumbnail_src[0]), esc_attr($img_alt)); echo '</div>'; } elseif (has_post_thumbnail($this_post->ID) && get_post(get_post_thumbnail_id($this_post->ID))) { echo '<div class="mosaic-block fade">'; $post_thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($this_post->ID), 'full'); $img_alt = get_post_meta(get_post_thumbnail_id($this_post->ID), '_wp_attachment_image_alt', true); $img_post = get_post(get_post_thumbnail_id($this_post->ID)); printf('<a href="%s" class="mosaic-overlay fancybox" title="%s"></a>', esc_url($post_thumbnail_src[0]), esc_attr($img_post->post_title)); printf('<div class="mosaic-backdrop"><img src="%s" alt="%s" /></div>', esc_url($post_thumbnail_src[0]), esc_attr($img_alt)); echo '</div>'; } } } else { for ($n = 0; $n < $times_to_repeat; $n++) { if (isset($consolidated_slider_array[$n])) { $post_thumbnail_src = wp_get_attachment_image_src($consolidated_slider_array[$n]['id'], 'timeline_gallery_thumb_x2'); $img_alt = get_post_meta($consolidated_slider_array[$n]['id'], '_wp_attachment_image_alt', true); $img_post = get_post($consolidated_slider_array[$n]['id']); printf('<span class="%s"><img src="%s" alt="%s" /></span>', esc_attr($gallery_class_array[$n]), esc_url($post_thumbnail_src[0]), esc_attr($img_alt)); } } } ?> </div> <!-- excerpt/content --> <?php if ($cmb_timeline_display_content == "checked") { echo do_shortcode($this_post->post_content); } else { if (empty($cmb_excerpt)) { echo mb_make_excerpt($this_post->post_content, $default_excerpt_length, true); } else { echo do_shortcode($cmb_excerpt); } } if ($cmb_timeline_link_through == "checked") { printf('…<a class="more" href="%s">%s</a>', esc_url(get_permalink($this_post->ID)), __("more", "loc_canon")); } ?> </div> </li> <?php } } //copy/paste end } die; }
get_header(); ?> <?php //SETTTINGS $cmb_gallery_style = get_post_meta($post->ID, 'cmb_gallery_style', true); $cmb_gallery_num_columns = get_post_meta($post->ID, 'cmb_gallery_num_columns', true); $cmb_gallery_source = get_post_meta($post->ID, 'cmb_gallery_source', true); // DEFAULTS if (empty($cmb_gallery_style)) { $cmb_gallery_style = "isotope"; } // HANDLE WP GALLERY SOURCE $consolidated_gallery_array = array(); $cmb_gallery_source = get_post_meta($post->ID, 'cmb_gallery_source', true); $gallery_array = mb_strip_wp_galleries_to_array($cmb_gallery_source); $consolidated_gallery_array = mb_convert_wp_galleries_array_to_consolidated_wp_gallery_array($gallery_array); // GET CLASSES $size_class = mb_get_size_class_from_num($cmb_gallery_num_columns, "third"); // var_dump($size_class); ?> <!-- Start Outter Wrapper --> <div class="outter-wrapper feature"> <hr/> </div> <!-- End Outter Wrapper --> <!-- start outter-wrapper --> <div class="outter-wrapper">
$canon_options_post['show_meta_comments'] = "checked"; } $has_meta = $canon_options_post['show_meta_author'] == "checked" || $canon_options_post['show_meta_date'] == "checked" || $canon_options_post['show_meta_comments'] == "checked" ? true : false; if (!isset($canon_options_post['show_tags'])) { $canon_options_post['show_tags'] = "checked"; } // FEATURE POSITION $feature_above_content = true; if ($cmb_single_style == "compact" || $cmb_single_style == "compact_sidebar") { $feature_above_content = false; } // HANDLE POST SLIDER $consolidated_slider_array = array(); if ($cmb_post_show_post_slider == "checked") { $cmb_post_slider_source = get_post_meta($post->ID, 'cmb_post_slider_source', true); $post_slider_array = mb_strip_wp_galleries_to_array($cmb_post_slider_source); $consolidated_slider_array = mb_convert_wp_galleries_array_to_consolidated_wp_gallery_array($post_slider_array); } // HAS SIDEBAR $has_sidebar = false; if ($cmb_single_style == "full_sidebar" || $cmb_single_style == "boxed_sidebar" || $cmb_single_style == "compact_sidebar") { $has_sidebar = true; } // SET MAIN CONTENT CLASS $main_content_class = "main-content"; if ($has_sidebar) { $main_content_class .= " three-fourths"; if ($canon_options['sidebars_alignment'] == 'left') { $main_content_class .= " left-main-content"; } }
function block_gallery_output($params) { extract($params); $block_classes = "outter-wrapper"; if (!empty($custom_classes)) { $block_classes .= " " . $custom_classes; } // HANDLE WP GALLERY SOURCE $consolidated_gallery_array = array(); $gallery_array = mb_strip_wp_galleries_to_array($source); $consolidated_gallery_array = mb_convert_wp_galleries_array_to_consolidated_wp_gallery_array($gallery_array); $size_class = mb_get_size_class_from_num($num_columns, "third"); // var_dump($size_class); ?> <!-- BLOCK: LATEST POSTS--> <!-- start outter-wrapper --> <div <?php pb_block_id_class($block_classes, $params); ?> <?php if ($bg_boxed != 'checked') { printf("data-stellar-background-ratio='{$parallax_ratio}'"); } ?> > <!-- block styles --> <style type="text/css" scoped> <?php include 'includes/inc_block_output_style.php'; ?> </style> <!-- start main-container --> <div class="main-container"> <!-- start main wrapper --> <div class="main wrapper clearfix" <?php if ($bg_boxed == 'checked') { printf("data-stellar-background-ratio='{$parallax_ratio}'"); } ?> > <!-- start main-content --> <div class="main-content"> <!-- Start Gallery --> <div class="clearfix"> <!-- Start Meta --> <aside class="clearfix"> <div class="text-seperator gal-sep"> <h5><?php echo $params['title']; ?> </h5> <ul class="meta option-set isotope_filter_menu right clearfix"> <?php if ($hide_filter_menu != "checked") { mb_list_categories_of_consolidated_wp_gallery($consolidated_gallery_array); } ?> </ul> </div> </aside> <!-- Start Isotope --> <div class="last thumb-gallery super-list variable-sizes pb_isotope_gallery" data-num_columns="<?php echo $num_columns; ?> "> <?php for ($i = 0; $i < count($consolidated_gallery_array); $i++) { $last_class = ($i + 1) % $num_columns ? "" : " last"; $cat_class = ""; foreach ($consolidated_gallery_array[$i]['categories'] as $key => $value) { $cat_class .= " " . $key; } $final_class = $size_class . $cat_class . $last_class; $post_thumbnail_src = wp_get_attachment_image_src($consolidated_gallery_array[$i]['id'], 'full'); $post_thumbnail_src_fit = wp_get_attachment_image_src($consolidated_gallery_array[$i]['id'], 'gallery_isotope_x2'); $img_alt = get_post_meta($consolidated_gallery_array[$i]['id'], '_wp_attachment_image_alt', true); $img_post = get_post($consolidated_gallery_array[$i]['id']); printf('<div class="gallery_item mosaic-block fade element %s">', esc_attr($final_class)); printf('<a href="%s" class="mosaic-overlay fancybox" title="%s"></a>', esc_url($post_thumbnail_src[0]), esc_attr($img_post->post_excerpt)); printf('<div class="mosaic-backdrop"><img src="%s" alt="%s" /></div>', esc_url($post_thumbnail_src_fit[0]), esc_attr($img_alt)); echo '</div>'; } ?> </div> <!-- end isotope --> </div> <!-- end gallery --> </div> <!-- end main-content --> </div> <!-- end main wrapper --> </div> <!-- end main-container --> </div> <!-- end outter-wrapper --> <!-- END BLOCK --> <?php return true; }
function block_gallery_preview_output($params) { extract($params); // BLOCK CLASSES $block_classes = "outter-wrapper"; if (!empty($custom_classes)) { $block_classes .= " " . $custom_classes; } // HANDLE WP GALLERY SOURCE $consolidated_gallery_array = array(); $gallery_array = mb_strip_wp_galleries_to_array($source); $consolidated_gallery_array = mb_convert_wp_galleries_array_to_consolidated_wp_gallery_array($gallery_array); $size_class = mb_get_size_class_from_num($num_columns, "third"); // var_dump($size_class); ?> <!-- BLOCK: LATEST POSTS--> <!-- start outter-wrapper --> <div <?php pb_block_id_class($block_classes, $params); ?> <?php if ($bg_boxed != 'checked') { printf("data-stellar-background-ratio='{$parallax_ratio}'"); } ?> > <!-- block styles --> <style type="text/css" scoped> <?php include 'includes/inc_block_output_style.php'; ?> </style> <!-- start main-container --> <div class="main-container"> <!-- start main wrapper --> <div class="main wrapper clearfix" <?php if ($bg_boxed == 'checked') { printf("data-stellar-background-ratio='{$parallax_ratio}'"); } ?> > <!-- start main-content --> <div class="main-content"> <!-- start gallery preview--> <div class="clearfix"> <!-- Start Meta --> <aside class="left-aside left fifth"> <ul class="meta"> <li><strong><?php echo $title; ?> </strong></li> <li><?php echo $meta_text; ?> </li> </ul> <?php if (!empty($description)) { printf('<p>%s</p>', do_shortcode($description)); } ?> <?php if (!empty($button_text)) { printf('<p><a href="%s" class="btn">%s</a></p>', esc_url($button_url), esc_attr($button_text)); } ?> </aside> <div class="four-fifths right last thumb-gallery"> <?php for ($i = 0; $i < count($consolidated_gallery_array); $i++) { $last_class = ($i + 1) % $num_columns ? "" : " last"; $cat_class = ""; foreach ($consolidated_gallery_array[$i]['categories'] as $key => $value) { $cat_class .= " " . $key; } $final_class = $size_class . $cat_class . $last_class; $post_thumbnail_src = wp_get_attachment_image_src($consolidated_gallery_array[$i]['id'], 'full'); $post_thumbnail_src_fit = wp_get_attachment_image_src($consolidated_gallery_array[$i]['id'], 'gallery_isotope_x2'); $img_alt = get_post_meta($consolidated_gallery_array[$i]['id'], '_wp_attachment_image_alt', true); $img_post = get_post($consolidated_gallery_array[$i]['id']); printf('<div class="%s"><img src="%s" alt="%s" /></div>', esc_attr($final_class), esc_url($post_thumbnail_src_fit[0]), esc_attr($img_alt)); } ?> </div> </div> <!-- end gallery preview--> </div> <!-- end main-content --> </div> <!-- end main wrapper --> </div> <!-- end main-container --> </div> <!-- end outter-wrapper --> <!-- END BLOCK --> <?php return true; }