function print_blog_thumbnail($post_id, $item_size) { $thumbnail_types = get_post_meta($post_id, 'post-option-thumbnail-types', true); if ($thumbnail_types == "Image" || empty($thumbnail_types)) { $thumbnail_id = get_post_thumbnail_id($post_id); $thumbnail = wp_get_attachment_image_src($thumbnail_id, $item_size); $alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); if (!empty($thumbnail)) { echo '<div class="blog-thumbnail-image">'; echo '<a href="' . get_permalink() . '"><img src="' . $thumbnail[0] . '" alt="' . $alt_text . '"/></a></div>'; } } else { if ($thumbnail_types == "Video") { $video_link = get_post_meta($post_id, 'post-option-thumbnail-video', true); echo '<div class="blog-thumbnail-video">'; echo get_video($video_link, gdl_get_width($item_size), gdl_get_height($item_size)); echo '</div>'; } else { if ($thumbnail_types == "Slider") { $slider_xml = get_post_meta($post_id, 'post-option-thumbnail-xml', true); $slider_xml_dom = new DOMDocument(); $slider_xml_dom->loadXML($slider_xml); echo '<div class="blog-thumbnail-slider">'; echo print_flex_slider($slider_xml_dom->documentElement, $item_size); echo '</div>'; } } } }
function print_single_blog_thumbnail($post_id, $item_size) { $thumbnail_types = get_post_meta($post_id, 'post-option-inside-thumbnail-types', true); if ($thumbnail_types == "Image" || empty($thumbnail_types)) { $thumbnail_id = get_post_meta($post_id, 'post-option-inside-thumbnial-image', true); $thumbnail = wp_get_attachment_image_src($thumbnail_id, $item_size); $thumbnail_full = wp_get_attachment_image_src($thumbnail_id, 'full'); $alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); if (!empty($thumbnail)) { echo '<div class="blog-media-wrapper gdl-image">'; echo '<a href="' . $thumbnail_full[0] . '" data-rel="fancybox" title="' . get_the_title() . '">'; echo '<img src="' . $thumbnail[0] . '" alt="' . $alt_text . '"/>'; echo '</a>'; echo '</div>'; // blog-media-wrapper } } else { if ($thumbnail_types == "Video") { $video_link = get_post_meta($post_id, 'post-option-inside-thumbnail-video', true); echo '<div class="blog-media-wrapper gdl-video">'; echo get_video($video_link, gdl_get_width($item_size), gdl_get_height($item_size)); echo '</div>'; // blog-media-wrapper } else { if ($thumbnail_types == "Slider") { $slider_xml = get_post_meta($post_id, 'post-option-inside-thumbnail-xml', true); $slider_xml_dom = new DOMDocument(); $slider_xml_dom->loadXML($slider_xml); echo '<div class="blog-media-wrapper gdl-slider">'; echo print_flex_slider($slider_xml_dom->documentElement, $item_size); echo '</div>'; // blog-media-wrapper } else { if ($thumbnail_types == "HTML5 Video") { $video = get_post_meta($post_id, 'post-option-inside-thumbnail-html5-video', true); echo '<div class="blog-media-wrapper gdl-html5-video">'; get_html5_video($video); echo '</div>'; // blog-media-wrapper } } } } }
function print_portfolio($item_xml) { wp_reset_query(); global $paged; global $sidebar; global $port_div_size_num_class; global $class_to_num; if (empty($paged)) { $paged = get_query_var('page') ? get_query_var('page') : 1; } // get the item class and size from array $port_size = find_xml_value($item_xml, 'item-size'); $item_class = $port_div_size_num_class[$port_size]['class']; if ($sidebar == "no-sidebar") { $item_size = $port_div_size_num_class[$port_size]['size']; } else { if ($sidebar == "left-sidebar" || $sidebar == "right-sidebar") { $item_size = $port_div_size_num_class[$port_size]['size2']; } else { $item_size = $port_div_size_num_class[$port_size]['size3']; } } // get the portfolio meta value $header = find_xml_value($item_xml, 'header'); $num_fetch = find_xml_value($item_xml, 'num-fetch'); $num_excerpt = find_xml_value($item_xml, 'num-excerpt'); $category = find_xml_value($item_xml, 'category'); $category_val = $category == 'All' ? '' : $category; $filterable = find_xml_value($item_xml, 'filterable'); $filter_class = ''; // portfolio header if (!empty($header)) { echo '<h3 class="portfolio-header-title title-color gdl-title">' . $header . '</h3>'; $view_all_project = find_xml_value($item_xml, 'view-all-project'); if ($view_all_project != 'No') { $view_all_project_link = get_permalink(get_page_by_title($view_all_project)); echo '<div class="portfolio-view-all-project">'; echo '<a href="' . $view_all_project_link . '">' . $translator_view_project . '</a>'; echo '</div>'; } } // category list for filter if ($filterable == "Yes") { $category_lists = get_category_list('portfolio-category', $category_val); echo '<ul id="portfolio-item-filter">'; foreach ($category_lists as $category_list) { $category_term = get_term_by('name', $category_list, 'portfolio-category'); if (!empty($category_term)) { $category_slug = $category_term->slug; } else { $category_slug = 'all'; } echo '<li><a href="#" class="gdl-button" data-value="' . $category_slug . '">' . $category_list . '</a></li>'; } echo '<div class="clear"></div>'; echo "</ul>"; } echo '<div class="clear"></div>'; // start fetching database global $post, $wp_query; if (!empty($category_val)) { $category_term = get_term_by('name', $category_val, 'portfolio-category'); $category_val = $category_term->slug; } $post_temp = query_posts(array('post_type' => 'portfolio', 'paged' => $paged, 'portfolio-category' => $category_val, 'posts_per_page' => $num_fetch)); echo '<div id="portfolio-item-holder" class="portfolio-item-holder">'; while (have_posts()) { the_post(); // get the category for filter $item_categories = get_the_terms($post->ID, 'portfolio-category'); $category_slug = " "; if (!empty($item_categories)) { foreach ($item_categories as $item_category) { $category_slug = $category_slug . $item_category->slug . ' '; } } // start printing data echo '<div class="' . $item_class . $category_slug . ' portfolio-item">'; $thumbnail_types = get_post_meta($post->ID, 'post-option-thumbnail-types', true); if ($thumbnail_types == "Image") { $image_type = get_post_meta($post->ID, 'post-option-featured-image-type', true); $image_type = empty($image_type) ? "Link to Current Post" : $image_type; $thumbnail_id = get_post_thumbnail_id(); $thumbnail = wp_get_attachment_image_src($thumbnail_id, $item_size); $alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); if ($image_type == "Link to Current Post") { $hover_thumb = "hover-link"; $pretty_photo = ""; $permalink = get_permalink(); } else { if ($image_type == "Link to URL") { $hover_thumb = "hover-link"; $pretty_photo = ""; $permalink = get_post_meta($post->ID, 'post-option-featured-image-url', true); } else { if ($image_type == "Lightbox to Current Thumbnail") { $hover_thumb = "hover-zoom"; $pretty_photo = ' data-rel="prettyPhoto" '; $permalink = wp_get_attachment_image_src($thumbnail_id, 'full'); $permalink = $permalink[0]; } else { if ($image_type == "Lightbox to Picture") { $hover_thumb = "hover-zoom"; $pretty_photo = ' data-rel="prettyPhoto" '; $permalink = get_post_meta($post->ID, 'post-option-featured-image-url', true); $permalink = $permalink; } else { $hover_thumb = "hover-video"; $pretty_photo = ' data-rel="prettyPhoto" '; $permalink = get_post_meta($post->ID, 'post-option-featured-image-url', true); $permalink = $permalink; } } } } if (!empty($thumbnail[0])) { echo '<div class="portfolio-thumbnail-image">'; echo '<div class="overflow-hidden">'; echo '<a href="' . $permalink . '" ' . $pretty_photo . ' title="' . get_the_title() . '">'; echo '<span class="portfolio-thumbnail-image-hover">'; echo '<span class="' . $hover_thumb . '"></span>'; echo '</span>'; echo '</a>'; echo '<img src="' . $thumbnail[0] . '" alt="' . $alt_text . '"/>'; echo '</div>'; // overflow-hidden echo '</div>'; // portfolio-thumbnail-image } else { echo '<div class="port-no-image" style="width:' . gdl_get_width($item_size) . 'px; height: ' . gdl_get_height($item_size) . 'px;"></div>'; } } else { if ($thumbnail_types == "Video") { $video_link = get_post_meta($post->ID, 'post-option-thumbnail-video', true); echo '<div class="portfolio-thumbnail-video">'; echo get_video($video_link, gdl_get_width($item_size), gdl_get_height($item_size)); echo '</div>'; } else { if ($thumbnail_types == "Slider") { $slider_xml = get_post_meta($post->ID, 'post-option-thumbnail-xml', true); $slider_xml_dom = new DOMDocument(); $slider_xml_dom->loadXML($slider_xml); echo '<div class="portfolio-thumbnail-slider">'; echo print_flex_slider($slider_xml_dom->documentElement, $item_size); echo '</div>'; } } } $show_port_title = find_xml_value($item_xml, "show-title") == "Yes"; $show_port_excerpt = find_xml_value($item_xml, "show-excerpt") == "Yes"; if ($show_port_excerpt || $show_port_title) { echo '<div class="portfolio-thumbnail-context">'; // portfolio title if ($show_port_title) { echo '<h2 class="portfolio-thumbnail-title port-title-color gdl-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>'; } // portfolio excerpt if ($show_port_excerpt) { echo '<div class="portfolio-thumbnail-content">' . mb_substr(get_the_excerpt(), 0, $num_excerpt) . '</div>'; } echo '</div>'; // portfolio thumbnail context } echo '</div>'; // portfolio item } echo "</div>"; // portfolio item holder echo '<div class="clear"></div>'; if (find_xml_value($item_xml, "pagination") == "Yes") { pagination(); } }
function print_portfolio($item_xml) { wp_reset_query(); // Translator words global $gdl_admin_translator; if ($gdl_admin_translator == 'enable') { $translator_visit_website = get_option(THEME_SHORT_NAME . '_translator_visit_website', 'Visit Website'); $translator_view_project = get_option(THEME_SHORT_NAME . '_translator_view_all_project', 'View All Projects →'); $translator_read_more = get_option(THEME_SHORT_NAME . '_translator_read_more', 'Read More'); } else { $translator_visit_website = __('Visit Website', 'gdl_front_end'); $translator_view_project = __('View All Projects →', 'gdl_front_end'); $translator_read_more = __('Read More', 'gdl_front_end'); } global $paged; global $sidebar; global $port_div_size_num_class; global $class_to_num; if (empty($paged)) { $paged = get_query_var('page') ? get_query_var('page') : 1; } // get the item class and size from array $port_size = find_xml_value($item_xml, 'item-size'); $item_class = $port_div_size_num_class[$port_size]['class']; if ($sidebar == "no-sidebar") { $item_size = $port_div_size_num_class[$port_size]['size']; } else { if ($sidebar == "left-sidebar" || $sidebar == "right-sidebar") { $item_size = $port_div_size_num_class[$port_size]['size2']; } else { $item_size = $port_div_size_num_class[$port_size]['size3']; } } // get the portfolio meta value $header = find_xml_value($item_xml, 'header'); $num_fetch = find_xml_value($item_xml, 'num-fetch'); $num_excerpt = find_xml_value($item_xml, 'num-excerpt'); $category = find_xml_value($item_xml, 'category'); $category_val = $category == 'All' ? '' : $category; $filterable = find_xml_value($item_xml, 'filterable'); $filter_class = ''; // start fetching database global $post, $wp_query; if (!empty($category_val)) { $category_term = get_term_by('name', $category_val, 'portfolio-category'); $category_val = $category_term->slug; } $post_temp = query_posts(array('post_type' => 'portfolio', 'paged' => $paged, 'portfolio-category' => $category_val, 'posts_per_page' => $num_fetch)); // check available category $avail_cat = array(); while (have_posts()) { the_post(); $post_categories = get_the_terms(get_the_ID(), 'portfolio-category'); if (!empty($post_categories)) { foreach ($post_categories as $category) { if (!in_array($category->slug, $avail_cat)) { array_push($avail_cat, $category->slug); } } } } rewind_posts(); // portfolio header if (!empty($header)) { echo '<h3 class="portfolio-header-title title-color gdl-title">' . $header . '</h3>'; $view_all_project = find_xml_value($item_xml, 'view-all-project'); if ($view_all_project != 'No') { $view_all_project_link = get_permalink(get_page_by_title($view_all_project)); echo '<div class="portfolio-view-all-project">'; echo '<a href="' . $view_all_project_link . '">' . $translator_view_project . '</a>'; echo '</div>'; } } // category list for filter if ($filterable == "Yes") { echo '<ul id="portfolio-item-filter">'; if (empty($category_val)) { echo '<li><a href="#" class="gdl-button active" data-value="all">All</a></li>'; $parent_id = 0; } else { $parent_id = get_term_by('slug', $category_val, 'portfolio-category'); echo '<li><a href="#" class="gdl-button active" data-value="' . $parent_id->slug . '">' . $parent_id->name . '</a></li>'; $parent_id = $parent_id->term_id; } $category_lists = get_categories(array('taxonomy' => 'portfolio-category', 'child_of' => $parent_id)); foreach ($category_lists as $category_list) { if (in_array($category_list->slug, $avail_cat)) { echo '<li><a href="#" class="gdl-button" data-value="' . $category_list->slug . '">' . $category_list->name . '</a></li>'; } } echo "</ul>"; } echo '<div class="clear"></div>'; // get the portfolio size $port_wrapper_size = $class_to_num[find_xml_value($item_xml, 'size')]; $port_current_size = 0; $port_size = $class_to_num[$port_size]; $port_num_have_bottom = sizeof($post_temp) % (int) ($port_wrapper_size / $port_size); $port_num_have_bottom = $port_num_have_bottom == 0 ? (int) ($port_wrapper_size / $port_size) : $port_num_have_bottom; $port_num_have_bottom = sizeof($post_temp) - $port_num_have_bottom; echo '<div id="portfolio-item-holder" class="portfolio-item-holder">'; while (have_posts()) { the_post(); // get the category for filter $item_categories = get_the_terms($post->ID, 'portfolio-category'); $category_slug = " "; if (!empty($item_categories)) { foreach ($item_categories as $item_category) { $category_slug = $category_slug . $item_category->slug . ' '; } } // start printing data echo '<div class="' . $item_class . $category_slug . ' mt0 pt25 portfolio-item">'; $thumbnail_types = get_post_meta($post->ID, 'post-option-thumbnail-types', true); if ($thumbnail_types == "Image") { $image_type = get_post_meta($post->ID, 'post-option-featured-image-type', true); $image_type = empty($image_type) ? "Link to Current Post" : $image_type; $thumbnail_id = get_post_thumbnail_id(); $thumbnail = wp_get_attachment_image_src($thumbnail_id, $item_size); $alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); if ($image_type == "Link to Current Post") { $hover_thumb = "hover-link"; $pretty_photo = ""; $permalink = get_permalink(); } else { if ($image_type == "Link to URL") { $hover_thumb = "hover-link"; $pretty_photo = ""; $permalink = __(get_post_meta($post->ID, 'post-option-featured-image-url', true), 'gdl_front_end'); } else { if ($image_type == "Lightbox to Current Thumbnail") { $hover_thumb = "hover-zoom"; $pretty_photo = ' data-rel="prettyPhoto" '; $permalink = wp_get_attachment_image_src($thumbnail_id, 'full'); $permalink = $permalink[0]; } else { if ($image_type == "Lightbox to Picture") { $hover_thumb = "hover-zoom"; $pretty_photo = ' data-rel="prettyPhoto" '; $permalink = __(get_post_meta($post->ID, 'post-option-featured-image-url', true), 'gdl_front_end'); $permalink = $permalink; } else { $hover_thumb = "hover-video"; $pretty_photo = ' data-rel="prettyPhoto" '; $permalink = __(get_post_meta($post->ID, 'post-option-featured-image-url', true), 'gdl_front_end'); $permalink = $permalink; } } } } if (!empty($thumbnail[0])) { echo '<div class="portfolio-thumbnail-image">'; echo '<div class="overflow-hidden">'; echo '<a href="' . $permalink . '" ' . $pretty_photo . ' title="' . get_the_title() . '">'; echo '<span class="portfolio-thumbnail-image-hover">'; echo '<span class="' . $hover_thumb . '"></span>'; echo '</span>'; echo '</a>'; echo '<img src="' . $thumbnail[0] . '" alt="' . $alt_text . '"/>'; echo '</div>'; //overflow hidden echo '</div>'; //portfolio thumbnail image } } else { if ($thumbnail_types == "Video") { $video_link = get_post_meta($post->ID, 'post-option-thumbnail-video', true); echo '<div class="portfolio-thumbnail-video">'; echo get_video($video_link, gdl_get_width($item_size), gdl_get_height($item_size)); echo '</div>'; } else { if ($thumbnail_types == "Slider") { $slider_xml = get_post_meta($post->ID, 'post-option-thumbnail-xml', true); $slider_xml_dom = new DOMDocument(); $slider_xml_dom->loadXML($slider_xml); echo '<div class="portfolio-thumbnail-slider">'; echo print_flex_slider($slider_xml_dom->documentElement, $item_size); echo '</div>'; } } } echo '<div class="portfolio-thumbnail-context">'; // portfolio title if (find_xml_value($item_xml, "show-title") == "Yes") { echo '<h2 class="portfolio-thumbnail-title port-title-color gdl-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>'; } // portfolio excerpt if (find_xml_value($item_xml, "show-excerpt") == "Yes") { echo '<div class="portfolio-thumbnail-content">' . mb_substr(get_the_excerpt(), 0, $num_excerpt) . '</div>'; } // read more button if (find_xml_value($item_xml, "read-more") == "Yes") { echo '<a href="' . get_permalink() . '" class="portfolio-read-more gdl-button">' . $translator_read_more . '</a>'; } // visit website if (find_xml_value($item_xml, "visit-website") == "Yes") { $website = get_post_meta($post->ID, 'post-option-website-url', true); if (!empty($website)) { echo '<a href="' . $website . '" class="portfolio-visit-website gdl-button">' . $translator_visit_website . '</a>'; } } echo '</div>'; // print space if not last line if ($port_current_size < $port_num_have_bottom) { if (find_xml_value($item_xml, "show-title") == 'Yes' || find_xml_value($item_xml, "show-excerpt") == "Yes" || find_xml_value($item_xml, "read-more") == "Yes" || find_xml_value($item_xml, "visit-website") == "Yes") { echo '<div class="portfolio-bottom"></div>'; } $port_current_size++; } echo '</div>'; } echo "</div>"; echo '<div class="clear"></div>'; if (find_xml_value($item_xml, "pagination") == "Yes") { pagination(); } }
function print_slider_item($item_xml) { $xml_size = find_xml_value($item_xml, 'size'); if ($xml_size == 'full-width') { echo '<div class="gdl-slider-wrapper fullwidth">'; } else { echo '<div class="gdl-slider-wrapper">'; } $slider_width = find_xml_value($item_xml, 'width'); $slider_height = find_xml_value($item_xml, 'height'); if (!empty($slider_width) && !empty($slider_height)) { $xml_size = $slider_width . 'x' . $slider_height; } else { if ($xml_size == 'full-width') { $xml_size = 'full'; } else { $xml_size = '980x360'; } } switch (find_xml_value($item_xml, 'slider-type')) { case 'Anything Slider': print_anything_slider(find_xml_node($item_xml, 'slider-item'), $xml_size); break; case 'Nivo Slider': print_nivo_slider(find_xml_node($item_xml, 'slider-item'), $xml_size); break; case 'Flex Slider': print_flex_slider(find_xml_node($item_xml, 'slider-item'), $xml_size); break; case 'Carousel Slider': print_carousel_slider(find_xml_node($item_xml, 'slider-item'), $xml_size); break; } echo "</div>"; }
echo '<a href="' . $thumbnail_full[0] . '" data-rel="prettyPhoto" title="' . get_the_title() . '" ><img src="' . $thumbnail[0] . '" alt="' . $alt_text . '"/></a>'; echo '</div>'; } break; case "Video": $video_link = get_post_meta($post->ID, 'post-option-inside-thumbnail-video', true); echo '<div class="blog-thumbnail-video">'; echo get_video($video_link, gdl_get_width($item_size), gdl_get_height($item_size)); echo '</div>'; break; case "Slider": $slider_xml = get_post_meta($post->ID, 'post-option-inside-thumbnail-xml', true); $slider_xml_dom = new DOMDocument(); $slider_xml_dom->loadXML($slider_xml); echo '<div class="blog-thumbnail-slider">'; echo print_flex_slider($slider_xml_dom->documentElement, $item_size); echo '</div>'; break; } echo "<div class='clear'></div>"; echo "<div class='single-content first-letter'>"; echo the_content(); echo "</div>"; // About Author if (get_post_meta($post->ID, 'post-option-author-info-enabled', true) == "Yes") { echo "<div class='about-author-wrapper'>"; echo "<div class='about-author-avartar'>" . get_avatar(get_the_author_meta('ID'), 90) . "</div>"; echo "<div class='about-author-info'>"; echo "<div class='about-author-title gdl-link-title gdl-title'>" . $translator_about_author . "</div>"; echo get_the_author_meta('description'); echo "</div>";