function canon_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?> "> <div> <!-- AVATAR --> <?php if (get_option('show_avatars') === '1') { echo '<div class="left">'; echo get_avatar($comment, $args['avatar_size'], '', 'comment-avatar'); echo '</div>'; } ?> <!-- META --> <h5><?php comment_author_link(); ?> </h5> <h6><?php echo mb_localize_datetime(get_comment_date(get_option('date_format') . ' (' . get_option('time_format') . ')')); ?> </h6> <!-- REPLY AND EDIT LINKS --> <?php comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'loc_canon'), 'depth' => $depth, 'max_depth' => $args['max_depth'])), $comment->comment_ID); ?> <?php edit_comment_link(__('Edit', 'loc_canon')); ?> <!-- THE COMMENT --> <?php if ($comment->comment_approved == '0') { printf('<span class="approval_pending_notice">%s</span>', __('Comment awaiting approval', 'loc_canon')); } ?> <?php comment_text(); ?> </div> </li> <?php }
<div class="archive-text"> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <ul class="post-meta archive"> <li class="author"><?php the_author(); ?> </li> <li class="date"><?php echo mb_localize_datetime(get_the_time(get_option('date_format'))); ?> </li> <li class="comment"><a href="<?php echo get_permalink(get_the_ID()); ?> #comments" class="comment"><?php printf(get_comments_number(get_the_ID())); ?> </a></li> </ul> <p><?php if (!empty($result_cmb_excerpt)) { echo $result_cmb_excerpt; } else { echo mb_make_excerpt(get_the_content(), 148, true);
function mb_get_breadcrumbs($args = array()) { global $post; extract($args); $output = ""; $separator = isset($separator) ? $separator : "/"; $separator_output = sprintf('<li><span class="canon_breadcrumbs_separator">%s</span></li>', $separator); $output .= '<ul class="canon_breadcrumbs">'; // HOME $home_output = '<i class="fa fa-home"></i>'; $output .= sprintf('<li><a href="%s">%s</a></li>', home_url(), $home_output); // IF BLOG AND NOT BLOG AS FRONT PAGE if (is_home() && !is_front_page()) { $blog_output = __('Blog', 'loc_canon'); $output .= $separator_output; $output .= sprintf('<li>%s</li>', $blog_output); } elseif (is_page() && !is_front_page()) { if ($post->post_parent) { $ancestor_ids = get_post_ancestors($post->ID); $ancestor_ids = array_reverse($ancestor_ids); foreach ($ancestor_ids as $ancestor_id) { $output .= $separator_output; $output .= sprintf('<li><a href="%s" title="%s">%s</a></li>', get_permalink($ancestor_id), get_the_title($ancestor_id), get_the_title($ancestor_id)); } } $output .= $separator_output; $output .= sprintf('<li>%s</li>', get_the_title()); } elseif (is_category() || is_single() && get_post_type() == "post") { // THE CATEGORY OBJECT global $wp_query; $post_type = get_post_type(); $category_slug = $wp_query->query_vars['category_name']; if (is_category() && get_category_by_slug($category_slug)) { $the_category_object = get_category_by_slug($category_slug); } else { $the_categories_array = get_the_category(); $the_category_object = $the_categories_array[0]; } // ADD CATEGORIES if (isset($the_category_object)) { $category_lineage_array = array(); $the_category_parent = $the_category_object->parent; //do this for all the category parents while ($the_category_parent !== 0) { $the_category_parent_object = get_category($the_category_parent); array_unshift($category_lineage_array, $the_category_parent_object->term_id); $the_category_parent = $the_category_parent_object->parent; } // now add category parents to output foreach ($category_lineage_array as $key => $term_id) { $category_lineage_object = get_category($term_id); $category_lineage_object_link = get_category_link($term_id); $output .= $separator_output; $output .= sprintf('<li><a href="%s">%s</a></li>', $category_lineage_object_link, $category_lineage_object->name); } // finally add the original category itself (wihtout link if category page) $output .= $separator_output; if (is_category()) { $output .= sprintf('<li>%s</li>', $the_category_object->name); } else { $the_category_object_link = get_category_link($the_category_object->term_id); $output .= sprintf('<li><a href="%s">%s</a></li>', $the_category_object_link, $the_category_object->name); } } // SINGLE if (is_single()) { $output .= $separator_output; $output .= sprintf('<li>%s</li>', get_the_title()); } } elseif (is_post_type_archive() || is_tax() || is_single() && get_post_type() != "post") { $post_type = get_post_type(); $post_type_object = get_post_type_object($post_type); // FIRST ADD THE CUSTOM POST TYPE NAME/LABEL $output .= $separator_output; $post_type_object_link = get_post_type_archive_link($post_type); $output .= sprintf('<li><a href="%s">%s</a></li>', $post_type_object_link, $post_type_object->label); // NEXT GET THE TERM OBJECT AND TERM TAXONOMY. IF THIS IS TAXONOMY PAGE YOU CAN GET DATA FROM QUERY IF SINGLE YOU WILL HAVE TO DETECT TERMS $the_term_object = null; $the_term_taxonomy = null; if (is_single()) { $taxonomies = get_object_taxonomies($post_type, 'objects'); // get the first term of the first taxonomy foreach ($taxonomies as $taxonomy_slug => $taxonomy) { // attempt to get terms $terms = get_the_terms($post->ID, $taxonomy_slug); // if succesfull if (!empty($terms)) { foreach ($terms as $term) { if ($post_type == "product" && $term->name == "simple") { continue; } // WooCommerce specific. WooCommerce first term is an internal use label with the name of simple. If detected skip and instead jump to next term which is first category. if (!isset($the_term_object)) { $the_term_object = $term; $the_term_taxonomy = $the_term_object->taxonomy; } } } } } elseif (is_tax()) { global $wp_query; $the_term_object = get_term($wp_query->queried_object->term_id, $wp_query->query_vars['taxonomy']); $the_term_taxonomy = $the_term_object->taxonomy; } // NEXT ADD THE CUSTOM POST TYPE TAXONOMIES // if this post has any terms if (isset($the_term_object)) { $term_lineage_array = array(); array_unshift($term_lineage_array, $the_term_object->term_id); $the_term_parent = $the_term_object->parent; //do this for all the term parents while ($the_term_parent !== 0) { $the_term_parent_object = get_term($the_term_parent, $the_term_taxonomy); array_unshift($term_lineage_array, $the_term_parent_object->term_id); $the_term_parent = $the_term_parent_object->parent; } // now add terms to output foreach ($term_lineage_array as $key => $term_id) { $term_lineage_object = get_term($term_id, $the_term_taxonomy); $term_lineage_object_link = get_term_link($term_id, $the_term_taxonomy); $output .= $separator_output; $output .= sprintf('<li><a href="%s">%s</a></li>', $term_lineage_object_link, $term_lineage_object->name); } } // // FINALLY ADD THE SINGLE NAME if (is_single()) { $output .= $separator_output; $output .= sprintf('<li>%s</li>', get_the_title()); } } elseif (is_date()) { // DATE $archive_year = get_the_time('Y'); $archive_month = get_the_time('m'); $archive_day = get_the_time('d'); // YEAR $year_link = get_year_link($archive_year); $output .= $separator_output; $output .= sprintf('<li><a href="%s">%s</a></li>', $year_link, $archive_year); // MONTH if (is_month() || is_day()) { $month_link = get_month_link($archive_year, $archive_month); $output .= $separator_output; $output .= sprintf('<li><a href="%s">%s</a></li>', $month_link, mb_localize_datetime(get_the_time("F"))); } if (is_day()) { // DAY $day_link = get_day_link($archive_year, $archive_month, $archive_day); $output .= $separator_output; $output .= sprintf('<li><a href="%s">%s</a></li>', $day_link, $archive_day); } } elseif (is_tag()) { $output .= $separator_output; $output .= sprintf('<li>%s: %s</li>', __('Tag', 'loc_canon'), single_tag_title('', false)); } elseif (is_author()) { $output .= $separator_output; $output .= sprintf('<li>%s: %s</li>', __('Author', 'loc_canon'), get_the_author_meta('display_name')); } elseif (is_search()) { $output .= $separator_output; $output .= sprintf('<li>%s: %s</li>', __('Search', 'loc_canon'), get_search_query()); } elseif (is_404()) { $output .= $separator_output; $output .= sprintf('<li>404</li>'); } $output .= '</ul>'; return $output; }
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; }
function block_featured_posts_output($params) { extract($params); $block_classes = "outter-wrapper"; if (!empty($custom_classes)) { $block_classes .= " " . $custom_classes; } // VARS $default_excerpt_length = 165; //build exclude string $exclude_string = ""; $results_exclude_posts = get_posts(array('numberposts' => -1, 'meta_key' => 'cmb_hide_from_popular', 'meta_value' => 'checked', 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'any')); if (count($results_exclude_posts) > 0) { $exclude_string = ""; for ($i = 0; $i < count($results_exclude_posts); $i++) { $exclude_string .= $results_exclude_posts[$i]->ID . ","; } $exclude_string = substr($exclude_string, 0, strlen($exclude_string) - 1); } //basic args $query_args = array(); $query_args = array_merge($query_args, array('post_type' => 'post', 'numberposts' => $num_posts, 'post_status' => 'publish', 'offset' => 0, 'suppress_filters' => false)); if ($show == "latest_posts") { $query_args = array_merge($query_args, array('category' => '', 'orderby' => 'post_date', 'order' => 'DESC')); } elseif ($show == "random_posts") { $query_args = array_merge($query_args, array('category' => '', 'orderby' => 'rand')); } elseif ($show == "popular_views") { $query_args = array_merge($query_args, array('category' => '', 'meta_key' => 'post_views', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'exclude' => $exclude_string)); } elseif ($show == "popular_comments") { $query_args = array_merge($query_args, array('category' => '', 'orderby' => 'comment_count', 'order' => 'DESC', 'exclude' => $exclude_string)); } elseif (strpos($show, "postcat_") !== false) { $show = str_replace("postcat_", "", $show); $query_args = array_merge($query_args, array('category_name' => $show, 'orderby' => 'post_date', 'order' => 'DESC')); } //final query $results_query = get_posts($query_args); // var_dump($query_args); // var_dump($results_query); //if less posts in query set num_posts to num query posts if (count($results_query) < $num_posts) { $num_posts = count($results_query); } ?> <!-- BLOCK: FEATURED 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 Post --> <div class="clearfix"> <?php if ($show_section_header == "checked") { ?> <!-- section header --> <div class="text-seperator"> <h5><?php echo $params['title']; ?> </h5> <?php if (!empty($params['button_text'])) { printf('<a class="btn right white-btn xsmall-btn" href="%s">%s</a>', esc_url($params['button_link']), esc_attr($params['button_text'])); } ?> </div> <?php } ?> <?php for ($i = 0; $i < count($results_query); $i++) { $current_post = $results_query[$i]; $cmb_excerpt = get_post_meta($current_post->ID, 'cmb_excerpt', true); $cmb_feature = get_post_meta($current_post->ID, 'cmb_feature', true); $cmb_media_link = get_post_meta($current_post->ID, 'cmb_media_link', true); $current_post_publish_date = mb_localize_datetime(get_the_time("j M", $current_post->ID)); // build classes $base_class = ""; $size_class = " " . mb_get_size_class_from_num($num_columns, "third"); $last_class = ($i + 1) % $num_columns ? "" : " last"; $final_class = $base_class . $size_class . $last_class; $last_class = " last"; if ($i === 0 || $i % $num_columns === 0) { echo '<div class="clearfix recentwork">'; } echo '<div class="' . $final_class . '">'; // featured image. For future reference this section has most in common with page-galleries.php gallery style 3 if ($show_featured_image == "checked") { 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($current_post->ID))) { echo '<div class="mosaic-block fade">'; $post_thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($current_post->ID), 'full'); $post_thumbnail_src_fit = wp_get_attachment_image_src(get_post_thumbnail_id($current_post->ID), 'featured_posts_thumb_x2'); $img_alt = get_post_meta(get_post_thumbnail_id($current_post->ID), '_wp_attachment_image_alt', true); $img_post = get_post(get_post_thumbnail_id($current_post->ID)); if ($link_to == "post") { printf('<a href="%s" class="mosaic-overlay link fancybox" title="%s"></a>', get_permalink($current_post->ID), esc_attr($img_post->post_title)); } else { printf('<a href="%s" class="mosaic-overlay fancybox-media fancybox.iframe play" rel="gallery"></a>', esc_attr($cmb_media_link)); } if ($show_date == "checked") { printf('<div class="mosaic-backdrop"><div class="corner-date">%s</div><img src="%s" alt="%s" /></div>', esc_attr($current_post_publish_date), esc_url($post_thumbnail_src_fit[0]), esc_attr($img_alt)); } else { printf('<div class="mosaic-backdrop"><img src="%s" alt="%s" /></div>', esc_url($post_thumbnail_src_fit[0]), esc_attr($img_alt)); } echo '</div>'; } elseif (has_post_thumbnail($current_post->ID) && get_post(get_post_thumbnail_id($current_post->ID))) { echo '<div class="mosaic-block fade">'; $post_thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($current_post->ID), 'full'); $post_thumbnail_src_fit = wp_get_attachment_image_src(get_post_thumbnail_id($current_post->ID), 'featured_posts_thumb_x2'); $img_alt = get_post_meta(get_post_thumbnail_id($current_post->ID), '_wp_attachment_image_alt', true); $img_post = get_post(get_post_thumbnail_id($current_post->ID)); if ($link_to == "post") { printf('<a href="%s" class="mosaic-overlay link fancybox" title="%s"></a>', get_permalink($current_post->ID), esc_attr($img_post->post_title)); } else { printf('<a href="%s" class="mosaic-overlay fancybox" title="%s"></a>', esc_url($post_thumbnail_src[0]), esc_attr($img_post->post_title)); } if ($show_date == "checked") { printf('<div class="mosaic-backdrop"><div class="corner-date">%s</div><img src="%s" alt="%s" /></div>', esc_attr($current_post_publish_date), esc_url($post_thumbnail_src_fit[0]), esc_attr($img_alt)); } else { printf('<div class="mosaic-backdrop"><img src="%s" alt="%s" /></div>', esc_url($post_thumbnail_src_fit[0]), esc_attr($img_alt)); } echo '</div>'; } } ?> <!-- title --> <?php if ($show_title == "checked") { printf('<h3><a href="%s">%s</a></h3>', esc_url(get_permalink($current_post->ID)), esc_attr($current_post->post_title)); } ?> <!-- excerpt --> <?php if ($show_excerpt == "checked") { if (empty($cmb_excerpt)) { echo mb_make_excerpt($current_post->post_content, $default_excerpt_length, true); } else { echo do_shortcode($cmb_excerpt); } } ?> <!-- more link --> <?php if ($show_more_link == "checked") { printf('<a class="more" href="%s">%s</a>', esc_url(get_permalink($current_post->ID)), __("more", "loc_sport_core_plugin")); } ?> <?php echo "</div>"; if (($i + 1) % $num_columns === 0 || $i + 1 === $num_posts) { echo '</div>'; } } ?> </div> </div> <!-- end main-content --> </div> <!-- end main wrapper --> </div> <!-- end main-container --> </div> <!-- end outter-wrapper --> <!-- END BLOCK --> <?php return true; }
} ?> "></div> </div> <h2><a href="<?php echo get_permalink($results_query[$i]->ID); ?> "><?php echo $results_query[$i]->post_title; ?> </a></h2> <ul class="meta"> <li><?php echo mb_localize_datetime(format_datetime_str(get_option('date_format'), $results_query[$i]->post_date)); ?> </li> <li><a href="<?php echo get_permalink($results_query[$i]->ID); ?> #comments" class="comment"><?php printf(get_comments_number($results_query[$i]->ID)); ?> </a></li> </ul> </div> <?php
$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)) {
function widget($args, $instance) { extract($args); extract($instance); // DEFAULTS if (empty($instance)) { $widget_title = 'Featured Post'; $orderby = 'post_date'; $order = 'DESC'; $use_short_excerpt = 'checked'; } // set this_post if (isset($post_ID)) { // WPML if (function_exists('icl_translate')) { $post_ID = icl_object_id($post_ID); } $this_post = get_post($post_ID); } else { $query_args = array(); $query_args = array_merge($query_args, array('post_type' => 'post', 'numberposts' => 1, 'post_status' => 'publish', 'offset' => 0, 'suppress_filters' => false, 'orderby' => "date", 'order' => "DESC")); $this_post = get_posts($query_args); $this_post = $this_post[0]; } // get post data $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); $this_post_publish_date = mb_localize_datetime(get_the_time("j M", $this_post->ID)); // set vars $short_excerpt_length = 70; $default_excerpt_length = 210; // WPML if (function_exists('icl_translate')) { $widget_title = icl_translate('loc_sport_widgets_plugin', "{$widget_id}-widget[widget_title]", $widget_title); } ?> <?php echo $before_widget; ?> <?php echo $before_title . $widget_title . $after_title; ?> <!-- 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"><div class="corner-date">%s</div><img src="%s" alt="%s" /></div>', esc_attr($this_post_publish_date), 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"><div class="corner-date">%s</div><img src="%s" alt="%s" /></div>', esc_attr($this_post_publish_date), esc_url($post_thumbnail_src[0]), esc_attr($img_alt)); echo '</div>'; } ?> <!-- title --> <h3 class="title"><a href="<?php echo get_permalink($this_post->ID); ?> "><?php echo $this_post->post_title; ?> </a></h3> <!-- excerpt --> <?php if ($use_short_excerpt == "checked") { echo mb_make_excerpt($this_post->post_content, $short_excerpt_length, true); } else { if (empty($cmb_excerpt)) { echo mb_make_excerpt($this_post->post_content, $default_excerpt_length, true); } else { echo do_shortcode($cmb_excerpt); } } ?> <a href="<?php echo get_permalink($this_post->ID); ?> " class="more"><?php _e("More", "loc_sport_widgets_plugin"); ?> </a> <?php echo $after_widget; ?> <?php }
if (get_post_meta($results_small_latest[$i]->ID, 'cmb_is_review', true) != 'checked') { echo get_post_format($results_small_latest[$i]->ID); } ?> "></div> </div> <h2><a href="<?php echo get_permalink($results_small_latest[$i]->ID); ?> "><?php echo $results_small_latest[$i]->post_title; ?> </a></h2> <ul class="meta"> <li><?php echo mb_localize_datetime(format_datetime_str(get_option('date_format'), $results_small_latest[$i]->post_date)); ?> </li> <li><a href="<?php echo get_permalink($results_small_latest[$i]->ID); ?> #comments" class="comment"><?php printf(get_comments_number($results_small_latest[$i]->ID)); ?> </a></li> </ul> </div>