function shortcode_portfolio($atts, $content = null, $code) { extract(shortcode_atts(array('column' => 4, 'cat' => '', 'max' => '12'), $atts)); $output = ''; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $terms = array(); if ($cat != '') { $cat = preg_replace('/\\s*,\\s*/', ',', $cat); foreach (explode(',', $cat) as $term_name) { $terms[] = get_term_by('name', $term_name, 'portfolio_categories'); } foreach ($terms as $term) { $term_ids[] = $term->term_id; } $args = array('posts_per_page' => $max, 'paged' => $paged, 'post_type' => 'portfolio', 'post_status' => 'publish', 'tax_query' => array(array('taxonomy' => 'portfolio_categories', 'field' => 'id', 'terms' => $term_ids))); } else { $args = array('posts_per_page' => $max, 'paged' => $paged, 'post_type' => 'portfolio', 'post_status' => 'publish'); } query_posts($args); if ($column == 1) { $width = 1200; $excerpt_length = 180; $column = 1; } else { if ($column == 2) { $width = 600; $excerpt_length = 180; $column = 2; } else { if ($column == 3) { $width = 400; $excerpt_length = 120; $column = 3; } else { if ($column == 4) { $width = 300; $excerpt_length = 80; $column = 4; } else { $width = 300; $column = 4; } } } } $output = '<div class="portfolios">'; $output .= '<ul class="portfolio_' . $column . 'column da-thumbs">'; $num_layout = substr($column, 0, 1); $i = 1; while (have_posts()) { the_post(); $terms = get_the_terms(get_the_ID(), 'portfolio_categories'); if (strlen($img = get_the_post_thumbnail(get_the_ID()))) { $image = wp_get_attachment_url(get_post_thumbnail_id(get_the_ID())); } else { $image = templatemela_get_first_post_images(get_the_ID()); } $src = mr_image_resize($image, $width, $width, true, 'left', false); if (empty($src) || $src == 'image_not_specified') { $src = get_template_directory_uri() . "/images/megnor/placeholder.png"; $image = $src; $src = mr_image_resize($src, $width, $width, true, 'left', false); } $terms_slug = array(); if (is_array($terms)) { foreach ($terms as $term) { $terms_slug[] = $term->slug; } } if ($i % $num_layout == 0) { $li_class = "last"; } else { if ($i % $num_layout == 1) { $li_class = "first"; } else { $li_class = "inner"; } } $output .= '<li class="' . $li_class . '">'; $more = get_post_meta(get_the_ID(), '_more', true); $output .= '<div class="main"><div class="image-block">'; if (get_option('portfolio', 'display_image') || $column == 1) { $output .= '<a href= "' . $image . '" class="mustang-gallery">'; $output .= '<img class="image1" src="' . $src . '"/ >'; $output .= '</a>'; } $output .= '<div class="other-box">'; $output .= '<div class="links">'; $output .= '<a href="' . $image . '" title="Click to view Full Image" class="icon zoom mustang-gallery"><i class="fa fa-search"></i></a>'; $output .= '<a href="' . get_permalink() . '" title="Click to view Read More" class="icon"><i class="fa fa-link"></i></a>'; $output .= '</div></div>'; $output .= '</div>'; $output .= '<h5><a href="' . get_permalink() . '">' . get_the_title() . '</a></h5>'; $output .= templatemela_portfolio_excerpt($excerpt_length); $output .= '</li>'; $i++; } $output .= '</ul>'; $output .= templatemela_shortcode_paging_nav(); $output .= '</div>'; wp_reset_query(); return $output; }
get_post_meta($post->ID, 'staff_rss', TRUE) ? $staff_rss = get_post_meta($post->ID, 'staff_rss', TRUE) : ($staff_rss = ''); get_post_meta($post->ID, 'staff_pinterest', TRUE) ? $staff_pinterest = get_post_meta($post->ID, 'staff_pinterest', TRUE) : ($staff_pinterest = ''); get_post_meta($post->ID, 'staff_skype', TRUE) ? $staff_skype = get_post_meta($post->ID, 'staff_skype', TRUE) : ($staff_skype = ''); ?> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <?php if (has_post_thumbnail() && !post_password_required()) { $post_image = wp_get_attachment_url(get_post_thumbnail_id($post->ID)); } else { $post_image = templatemela_get_first_post_images(get_the_ID()); } ?> <div class="entry-content"> <div class="staff-left"> <div class="staff-image"> <?php templatemela_print_images_thumb($post_image, get_the_title(get_the_ID()), 200, 200, 'left'); ?> </div> </div> <div class="staff-right"> <div class="staff-name"><?php echo esc_attr(the_title()); ?> </div>