esc_html__("Portfolio Posts", 'taskereasy'), "base" => "taskereasy_portfolios_post", 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png', "class" => "", "description" => esc_html__("Add taskereasy portfolios post type", 'taskereasy'), "category" => esc_html__('Taskereasy Shortcodes', 'taskereasy'), "params" => array( array( "type" => "dropdown", "heading" => esc_html__("Post Columns", 'taskereasy'), "param_name" => "post_coloumns", "value" => array('Two with big column' => '3', 'Three with big column' => '4'), ), array( 'type' => 'css_editor', 'heading' => esc_html__( 'CSS', 'taskereasy' ), 'param_name' => 'custom_design', 'group' => esc_html__( 'Design options', 'taskereasy' ), ) ) )); add_shortcode( 'taskereasy_portfolios_post', function($atts, $content = null) { extract(shortcode_atts(array( 'blog_post' => '', 'post_coloumns' => '3', 'post_style' => 'grid', 'custom_design' => '', ), $atts)); $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' ); $postcoloumns = html_entity_decode(vc_value_from_safe($post_coloumns, true)); $output = ''; $output .= '
'; $col_num = ($postcoloumns == '3')? '6' : '4'; $args = array( 'post_type' => 'portfolios', 'orderby' => 'date', 'posts_per_page' => $postcoloumns-1, 'offset' => 0, ); $the_query = new WP_Query( $args ); $output .= '
'; if ( $the_query->have_posts() ) : global $post; while ( $the_query->have_posts() ) : $the_query->the_post(); $output .='
'; if(has_post_thumbnail()){ $output .= '
'.get_the_post_thumbnail().'
'; } $output .= '
'; $term_list = wp_get_post_terms($post->ID, 'portfoliocategories', array("fields" => "all")); //$output .= print_r($term_list); $count = count($term_list); foreach($term_list as $term){ $output .= ' '; } $output .= '

'.get_the_title().'

'; endwhile; wp_reset_postdata(); else : $output .= '

'.esc_html__( 'Sorry, no posts matched your criteria.', 'taskereasy' ) .'

'; endif; $output .= '
'; //full portfolio $full_args = array( 'post_type' => 'portfolios', 'posts_per_page' => 1, 'orderby' => 'date', 'offset' => $postcoloumns-1, ); $the_query = new WP_Query( $full_args ); if ( $the_query->have_posts() ) { global $post; $output .= '
'; while ( $the_query->have_posts() ) { $the_query->the_post(); $output .= '
'; if(has_post_thumbnail()){ $output .= '
'.get_the_post_thumbnail().'
'; } $output .= '
'; $term_list = wp_get_post_terms($post->ID, 'portfoliocategories', array("fields" => "all")); //$output .= print_r($term_list); $count = count($term_list); foreach($term_list as $term){ $output .= ' '; } $output .= '

'.get_the_title().'

'.taskereasy_custom_excerpt_length(20).'

'.esc_html__('Read More', 'taskereasy').'
'; } //end while wp_reset_postdata(); $output .= '
'; } // end if posts else { $output .= '

'.esc_html__( 'Sorry, no posts matched your criteria.', 'taskereasy' ) .'

'; } $output .= '
'; return $output; });