function gdlr_get_portfolio_thumbnail($post_option, $size = 'full', $modern_style = false) { global $gdlr_related_section; if (is_single() && $post_option['inside-thumbnail-type'] != 'thumbnail-type' && empty($gdlr_related_section)) { $type = 'inside-'; } else { $type = ''; } switch ($post_option[$type . 'thumbnail-type']) { case 'feature-image': $image_id = get_post_thumbnail_id(); if (!empty($image_id)) { if ($modern_style) { $ret = gdlr_get_image($image_id, $size); $ret .= '<span class="portfolio-overlay" > </span>'; $ret .= '<div class="portfolio-overlay-content">'; $ret .= '<a class="portfolio-overlay-wrapper" ' . gdlr_get_portfolio_thumbnail_link($post_option) . ' >'; $ret .= '<span class="portfolio-icon" ><i class="' . gdlr_get_portfolio_icon_class($post_option) . '" ></i></span>'; $ret .= '</a>'; $ret .= '<h3 class="portfolio-title"><a ' . gdlr_get_portfolio_thumbnail_link($post_option, 'title') . ' >' . get_the_title() . '</a></h3>'; $ret .= '</div>'; // portfolio-overlay-content } else { if (!is_single() || $gdlr_related_section) { $ret = gdlr_get_image($image_id, $size); $ret .= '<a class="portfolio-overlay-wrapper" ' . gdlr_get_portfolio_thumbnail_link($post_option) . ' >'; $ret .= '<span class="portfolio-overlay" > </span>'; $ret .= '<span class="portfolio-icon" ><i class="' . gdlr_get_portfolio_icon_class($post_option) . '" ></i></span>'; $ret .= '</a>'; } else { $ret = gdlr_get_image($image_id, $size, true); } } } break; case 'image': $ret = gdlr_get_image($post_option[$type . 'thumbnail-image'], $size, true); break; case 'video': if (is_single() && empty($gdlr_related_section)) { $ret = gdlr_get_video($post_option[$type . 'thumbnail-video'], 'full'); } else { $ret = gdlr_get_video($post_option[$type . 'thumbnail-video'], $size); } break; case 'gallery': $settings = array(); $settings['slider'] = $post_option['inside-thumbnail-slider']; $settings['thumbnail-size'] = $post_option['inside-gallery-thumbnail']; $settings['gallery-columns'] = $post_option['inside-gallery-columns']; $settings['show-caption'] = $post_option['inside-gallery-caption']; $settings['gallery-style'] = 'grid'; $ret = gdlr_get_gallery_item($settings); break; case 'slider': $ret = gdlr_get_slider($post_option[$type . 'thumbnail-slider'], $size); break; case 'stack-image': $ret = gdlr_get_stack_images($post_option[$type . 'thumbnail-slider']); break; default: $ret = ''; } return $ret; }
function gdlr_get_room_thumbnail($post_option, $size = 'full') { if (is_single() && $post_option['inside-thumbnail-type'] != 'thumbnail-type') { $type = 'inside-'; } else { $type = ''; } $ret = ''; switch ($post_option[$type . 'thumbnail-type']) { case 'feature-image': $image_id = get_post_thumbnail_id(); if (!empty($image_id)) { if (is_single()) { $ret = gdlr_get_image($image_id, $size, true); } else { $ret = '<a href="' . get_permalink() . '" >'; $ret .= gdlr_get_image($image_id, $size); $ret .= '</a>'; } } break; case 'image': $ret = gdlr_get_image($post_option[$type . 'thumbnail-image'], $size, true); break; case 'video': if (is_single()) { $ret = gdlr_get_video($post_option[$type . 'thumbnail-video'], 'full'); } else { $ret = gdlr_get_video($post_option[$type . 'thumbnail-video'], $size); } break; case 'slider': $ret = gdlr_get_slider($post_option[$type . 'thumbnail-slider'], $size); break; case 'stack-image': $ret = gdlr_get_stack_images($post_option[$type . 'thumbnail-slider']); break; default: $ret = ''; } return $ret; }
function gdlr_get_portfolio_thumbnail($post_option, $size = 'full') { global $gdlr_related_section; if (is_single() && $post_option['inside-thumbnail-type'] != 'thumbnail-type' && empty($gdlr_related_section)) { $type = 'inside-'; } else { $type = ''; } switch ($post_option[$type . 'thumbnail-type']) { case 'feature-image': $image_id = get_post_thumbnail_id(); if (!empty($image_id)) { if (!is_single() || $gdlr_related_section) { $ret = gdlr_get_image($image_id, $size); $ret .= '<a class="portfolio-overlay-wrapper" ' . gdlr_get_portfolio_thumbnail_link($post_option) . ' >'; $ret .= '<span class="portfolio-overlay" > </span>'; $ret .= '<span class="portfolio-icon" ><i class="' . gdlr_get_portfolio_icon_class($post_option) . '" ></i></span>'; $ret .= '</a>'; } else { $ret = gdlr_get_image($image_id, $size, true); } } break; case 'image': $ret = gdlr_get_image($post_option[$type . 'thumbnail-image'], $size, true); break; case 'video': if (is_single() && empty($gdlr_related_section)) { $ret = gdlr_get_video($post_option[$type . 'thumbnail-video'], 'full'); } else { $ret = gdlr_get_video($post_option[$type . 'thumbnail-video'], $size); } break; case 'slider': $ret = gdlr_get_slider($post_option[$type . 'thumbnail-slider'], $size); break; case 'stack-image': $ret = gdlr_get_stack_images($post_option[$type . 'thumbnail-slider']); break; default: $ret = ''; } return $ret; }
function gdlr_get_post_slider_item($settings) { $item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" '; global $gdlr_spaces; $margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : ''; $margin_style = !empty($margin) ? ' style="' . $margin . '" ' : ''; $slide_order = array(); $slide_data = array(); // query posts section $args = array('post_type' => 'post', 'suppress_filters' => false); $args['posts_per_page'] = empty($settings['num-fetch']) ? '5' : $settings['num-fetch']; $args['orderby'] = empty($settings['orderby']) ? 'post_date' : $settings['orderby']; $args['order'] = empty($settings['order']) ? 'desc' : $settings['order']; $args['ignore_sticky_posts'] = 1; if (is_numeric($settings['category'])) { $args['category'] = empty($settings['category']) ? '' : $settings['category']; } else { if (!empty($settings['category']) || !empty($settings['tag'])) { $args['tax_query'] = array('relation' => 'OR'); if (!empty($settings['category'])) { array_push($args['tax_query'], array('terms' => explode(',', $settings['category']), 'taxonomy' => 'category', 'field' => 'slug')); } if (!empty($settings['tag'])) { array_push($args['tax_query'], array('terms' => explode(',', $settings['tag']), 'taxonomy' => 'post_tag', 'field' => 'slug')); } } } $query = new WP_Query($args); // set the excerpt length global $theme_option, $gdlr_excerpt_length, $gdlr_excerpt_read_more; $gdlr_excerpt_read_more = false; $gdlr_excerpt_length = $settings['num-excerpt']; add_filter('excerpt_length', 'gdlr_set_excerpt_length'); global $post; while ($query->have_posts()) { $query->the_post(); $image_id = get_post_thumbnail_id(); if (!empty($image_id)) { $slide_order[] = $image_id; $slide_data[$image_id] = array('title' => get_the_title(), 'slide-link' => 'url', 'url' => get_permalink(), 'new-tab' => 'disable', 'caption-position' => $settings['caption-style']); if ($settings['style'] == 'no-excerpt') { $slide_data[$image_id]['caption'] = '<div class="gdlr-caption-date" >'; $slide_data[$image_id]['caption'] .= '<i class="fa ' . gdlr_fa_class('icon-calendar') . '"></i>'; $slide_data[$image_id]['caption'] .= get_the_time($theme_option['date-format']); $slide_data[$image_id]['caption'] .= '</div>'; $slide_data[$image_id]['caption'] .= '<div class="gdlr-title-link" >'; $slide_data[$image_id]['caption'] .= '<i class="icon-angle-right" ></i>'; $slide_data[$image_id]['caption'] .= '</div>'; } else { $slide_data[$image_id]['caption'] = '<div class="blog-info blog-date"><i class="fa ' . gdlr_fa_class('icon-calendar') . '"></i>'; $slide_data[$image_id]['caption'] .= get_the_time($theme_option['date-format']); $slide_data[$image_id]['caption'] .= '</div>'; $slide_data[$image_id]['caption'] .= '<div class="blog-info blog-comment"><i class="fa ' . gdlr_fa_class('icon-comment') . '"></i>'; $slide_data[$image_id]['caption'] .= get_comments_number(); $slide_data[$image_id]['caption'] .= '</div>'; $slide_data[$image_id]['caption'] .= '<div class="clear"></div>'; $slide_data[$image_id]['caption'] .= get_the_excerpt(); } } } $gdlr_excerpt_read_more = true; remove_filter('excerpt_length', 'gdlr_set_excerpt_length'); if ($settings['style'] == 'no-excerpt') { $settings['caption-style'] = 'no-excerpt'; } $ret = '<div class="gdlr-item gdlr-post-slider-item style-' . $settings['caption-style'] . '" ' . $item_id . $margin_style . ' >'; $ret .= gdlr_get_slider(array($slide_order, $slide_data), $settings['thumbnail-size'], 'flexslider'); $ret .= '</div>'; return $ret; }
function gdlr_get_post_slider_item($settings) { $item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" '; global $gdlr_spaces; $margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : ''; $margin_style = !empty($margin) ? ' style="' . $margin . '" ' : ''; $slide_order = array(); $slide_data = array(); // query posts section $settings['post-type'] = empty($settings['post-type']) ? 'post' : $settings['post-type']; $args = array('post_type' => $settings['post-type'], 'suppress_filters' => false); $args['posts_per_page'] = empty($settings['num-fetch']) ? '5' : $settings['num-fetch']; $args['orderby'] = empty($settings['orderby']) ? 'post_date' : $settings['orderby']; $args['order'] = empty($settings['order']) ? 'desc' : $settings['order']; if ($settings['post-type'] == 'cause' && $settings['cause-category']) { $args['tax_query'] = array(array('terms' => explode(',', $settings['cause-category']), 'taxonomy' => 'cause_category', 'field' => 'slug')); } else { if ($settings['post-type'] == 'post') { $args['tax_query'] = array(array('terms' => explode(',', $settings['category']), 'taxonomy' => 'category', 'field' => 'slug')); } } $args['ignore_sticky_posts'] = 1; $query = new WP_Query($args); // set the excerpt length global $theme_option, $gdlr_excerpt_length, $gdlr_excerpt_read_more; $gdlr_excerpt_length = $settings['num-excerpt']; add_filter('excerpt_length', 'gdlr_set_excerpt_length'); global $post; while ($query->have_posts()) { $query->the_post(); $image_id = get_post_thumbnail_id(); if (!empty($image_id)) { $slide_order[] = $image_id; $slide_data[$image_id] = array('title' => get_the_title(), 'slide-link' => 'url', 'url' => get_permalink(), 'new-tab' => 'disable', 'caption-position' => $settings['caption-style']); $slide_data[$image_id]['caption'] = '<div class="post-slider-caption-overlay"></div>'; if ($settings['post-type'] == 'post') { $slide_data[$image_id]['caption'] .= '<div class="blog-info blog-date"><i class="icon-time"></i>'; $slide_data[$image_id]['caption'] .= get_the_time($theme_option['date-format']); $slide_data[$image_id]['caption'] .= '</div>'; $slide_data[$image_id]['caption'] .= '<div class="blog-info blog-comment"><i class="icon-comment"></i>'; $slide_data[$image_id]['caption'] .= get_comments_number(); $slide_data[$image_id]['caption'] .= '</div>'; $slide_data[$image_id]['caption'] .= '<div class="clear"></div>'; } $slide_data[$image_id]['caption'] .= get_the_excerpt(); if ($settings['post-type'] == 'cause' && function_exists('gdlr_cause_donation_button')) { $cause_option = json_decode(gdlr_decode_preventslashes(get_post_meta(get_the_ID(), 'post-option', true)), true); $slide_data[$image_id]['caption'] .= gdlr_cause_donation_button($cause_option); } } } remove_filter('excerpt_length', 'gdlr_set_excerpt_length'); $feature_text = ''; if ($settings['caption-style'] != 'post-bottom post-slider') { if ($settings['post-type'] == 'cause') { $feature_text = __('Featured Causes', 'gdlr_translate'); } else { $feature_text = __('Featured Posts', 'gdlr_translate'); } } $ret = '<div class="gdlr-item gdlr-post-slider-item style-' . $settings['caption-style'] . '" ' . $item_id . $margin_style . ' >'; $ret .= gdlr_get_slider(array($slide_order, $slide_data), $settings['thumbnail-size'], 'flexslider', $feature_text); $ret .= '</div>'; return $ret; }