<a class="overlay<?php echo $ajax; ?> " href="<?php echo $link; ?> " target="<?php echo $target; ?> "> <h3><?php the_title(); ?> </h3> <p><?php echo van_truncate(strip_tags(get_the_content()), $limit); ?> </p> </a> <div class="tools"> <?php if ($portfolio_link == '') { ?> <span data-url="<?php the_permalink(); ?> "><a href="javascript:void(0);" class="zoomin ajax">ZoomIn</a></span> <a href="<?php the_permalink(); ?> " class="info">Info</a>
function van_portfolios($category_slug = '', $items = 6, $lightbox = 1, $ajax = 0, $intro = 1, $col = 3, $orderby = 'date', $echo = TRUE) { global $post; $tmp_post = $post; if ($category_slug != '') { $category_array = explode(',', $category_slug); $args = array('numberposts' => $items, 'post_type' => 'portfolio', 'orderby' => 'post_date', 'order' => 'DESC', 'tax_query' => array(array('taxonomy' => 'portfolios', 'field' => 'slug', 'terms' => $category_array, 'include_children' => false))); } else { if ($orderby == 'date') { $args = array('numberposts' => $items, 'post_type' => 'portfolio', 'orderby' => 'post_date', 'order' => 'DESC'); } elseif ($orderby == 'rand') { $args = array('numberposts' => $items, 'post_type' => 'portfolio', 'orderby' => 'rand'); } } $posts = get_posts($args); $return_html = '<div class="portfolios columns' . $col . '">'; foreach ($posts as $post) { setup_postdata($post); if (has_post_thumbnail($post->ID)) { $image_id = get_post_thumbnail_id($post->ID); $image_url = wp_get_attachment_image_src($image_id, 'full', true); if ($col == 3 || $col == '') { $excerpt = van_truncate(strip_tags(do_shortcode($post->post_content)), 180); $thumbnail_url = wp_get_attachment_image_src($image_id, 'portfolio_thumbnail', true); } elseif ($col == 4) { $excerpt = van_truncate(strip_tags(do_shortcode($post->post_content)), 120); $thumbnail_url = wp_get_attachment_image_src($image_id, 'portfolio_thumbnail_4', true); } elseif ($col == 5) { $excerpt = van_truncate(strip_tags(do_shortcode($post->post_content)), 80); $thumbnail_url = wp_get_attachment_image_src($image_id, 'portfolio_thumbnail_5', true); } if (van_is_mobile()) { $thumbnail_url = wp_get_attachment_image_src($image_id, 'portfolio_thumbnail', true); } if ($post->post_excerpt) { $description = $post->post_excerpt; } else { $description = $excerpt; } $portfolio_type = trim(strip_tags(get_post_meta($post->ID, "portfolio_type_value", true))); $portfolio_video = trim(strip_tags(get_post_meta($post->ID, "portfolio_video_value", true))); $portfolio_audio = trim(strip_tags(get_post_meta($post->ID, "portfolio_audio_value", true))); $portfolio_link = trim(strip_tags(get_post_meta($post->ID, "portfolio_link_value", true))); if ($portfolio_type == '') { $portfolio_type = "Image"; } if ($ajax == 0) { if ($lightbox == 1) { switch ($portfolio_type) { case 'Image': $class = " lightbox"; $url = $image_url[0]; $dataUrl = ' data-url=""'; break; case 'Video': $class = ""; $url = get_permalink($post->ID); $dataUrl = ' data-url=""'; break; case 'Audio': $class = ""; $url = get_permalink($post->ID); $dataUrl = ' data-url=""'; break; } } elseif ($lightbox == 0) { $class = ' data-url=""'; $url = get_permalink($post->ID); $dataUrl = ""; } else { $class = ""; $url = get_permalink($post->ID); } } else { $class = " ajax"; $url = 'javascript:void(0)'; $dataUrl = ' data-url="' . get_permalink($post->ID) . '"'; } $target = ''; if ($portfolio_link != '' && isset($portfolio_link)) { $url = $portfolio_link; $target = ' target="_blank"'; $dataUrl = ''; $class = ''; } $terms = get_the_terms($post->ID, 'portfolios'); $slug = array(); if ($terms && !is_wp_error($terms)) { foreach ($terms as $term) { $slug[] = $term->slug; } } $on_slug = join(" ", $slug); $return_html .= '<div class="portfolio-item ' . $on_slug . '" id="portfolio-' . $post->ID . '"' . $dataUrl . '> <a class="overlay' . $class . '" href="' . $url . '" title="' . $post->post_title . '"' . $target . '>'; $return_html .= '<h3>' . $post->post_title . '</h3>'; if ($intro == 1) { $return_html .= '<p class="intro">' . $description . '</p>'; } $return_html .= '</a> <div class="tools">'; $return_html .= '<span' . $dataUrl . '><a href="' . $url . '" class="zoomin' . $class . '" title="' . $post->post_title . '">ZoomIn</a></span>'; if ($portfolio_link != '' && isset($portfolio_link)) { $return_html .= '<a href="' . $url . '" class="info"' . $target . '>Info</a>'; } else { $return_html .= '<a href="' . get_permalink($post->ID) . '" class="info">Info</a>'; } $return_html .= '</div> <a href="' . $url . '" class="item' . $class . '"><img src="' . $thumbnail_url[0] . '" alt="' . $post->post_title . '" /></a>'; $return_html .= '</div>' . PHP_EOL; } } $post = $tmp_post; $return_html .= '<div class="clearfix"></div></div>'; if ($echo) { echo $return_html; } else { return $return_html; } }
the_permalink(); ?> " title="<?php echo esc_attr(get_the_title()); ?> " rel="bookmark"><?php the_title(); ?> </a></h2> <div class="entry"> <?php if (has_post_thumbnail()) { if ($post->post_excerpt) { the_excerpt(); } else { echo van_truncate(strip_tags(get_the_content()), 200); } echo '<a href="' . get_permalink() . '" class="more-link">' . __('Read More »', 'SimpleKey') . '</a>'; } else { if ($post->post_excerpt) { the_excerpt(); } else { van_content(true, true); } } ?> </div> <div class="clearfix"></div> </article> <?php }