esc_html__("Services Tabs", 'taskereasy'), "base" => "taskereasy_tabs", 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png', "class" => "", "description" => esc_html__("Add taskereasy Tabs", 'taskereasy'), "category" => esc_html__('Taskereasy Shortcodes', 'taskereasy'), "params" => array( array( "type" => "dropdown", "heading" => esc_html__("Style", 'taskereasy'), "param_name" => "style", "value" => array('Style 1' => 'style_1', 'Style 2' => 'style_2', 'Style 3' => 'style_3'), ), array( "type" => "textfield", "heading" => esc_html__("Title", 'taskereasy'), "param_name" => "title", "dependency" => array( "element" => "style", "value" => "style_2" ), ), array( "type" => "textarea_safe", "heading" => esc_html__("Subtitle", 'taskereasy'), "param_name" => "subtext", "dependency" => array( "element" => "style", "value" => "style_2" ), ), array( 'type' => 'css_editor', 'heading' => esc_html__( 'CSS', 'taskereasy' ), 'param_name' => 'custom_design', 'group' => esc_html__( 'Design options', 'taskereasy' ), ) ) )); add_shortcode( 'taskereasy_tabs', function($atts, $content = null) { extract(shortcode_atts(array( 'style' => 'style_1', 'title' => '', 'subtext' => '', 'custom_design' => '', ), $atts)); $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' ); $terms = get_terms( 'servicecategories', 'orderby=asc&hide_empty=true&number=5&offset=0' ); $post_taxomnomy = get_term_by( 'slug', 'servicecategories' ); $output = ''; $count = 0; $counttab = 0; $service_id = ($style == 'style_1') ? 'services' : 'services-3'; $output .= '
'; if($style == 'style_1'){ //Style 1 $output .='
'; $custom_terms = get_terms('servicecategories'); foreach($custom_terms as $custom_term) { $args = array( 'post_type' => 'services', 'orderby' => 'date', 'posts_per_page' => 1, 'tax_query' => array( array( 'taxonomy' => 'servicecategories', 'field' => 'slug', 'terms' => $custom_term->slug, ), ), ); $loop = new WP_Query($args); if($loop->have_posts()) { while($loop->have_posts()) : $loop->the_post(); $activetab = ($counttab == 0) ? 'active' : ''; if(has_post_thumbnail()){ $bg_img = get_the_post_thumbnail_url(); } $output .= '

'.get_the_title().'

'.taskereasy_custom_excerpt_length(40).'

'.esc_html__("Start Now", "taskereasy").'
'.get_the_title().'
'; $counttab++; endwhile; } wp_reset_postdata(); } $output .= '
'; }elseif($style == 'style_2'){ //Style 2 $output.= '

'.$title.'

'.$title.'

'.$subtext.'

'; $custom_terms = get_terms('servicecategories'); foreach($custom_terms as $custom_term) { wp_reset_query(); $args = array('post_type' => 'services', 'orderby' => 'date', 'posts_per_page' => 1, 'tax_query' => array( array( 'taxonomy' => 'servicecategories', 'field' => 'slug', 'terms' => $custom_term->slug, ), ), ); $loop = new WP_Query($args); if($loop->have_posts()) { while($loop->have_posts()) : $loop->the_post(); $activetab = ($counttab == 0) ? 'active' : ''; $output .= '

'.get_the_title().'

'.taskereasy_custom_excerpt_length(40).'

'.esc_html__("Start Now", "taskereasy").'
'; $counttab++; endwhile; } wp_reset_postdata(); } $output.='
'; }else{ $output.= '
'; $custom_terms = get_terms('servicecategories'); foreach($custom_terms as $custom_term) { wp_reset_query(); $args = array( 'post_type' => 'services', 'orderby' => 'date', 'posts_per_page' => 1, 'tax_query' => array( array( 'taxonomy' => 'servicecategories', 'field' => 'slug', 'terms' => $custom_term->slug, ), ), ); $loop = new WP_Query($args); if($loop->have_posts()) { while($loop->have_posts()) : $loop->the_post(); $bg_img = (has_post_thumbnail()) ? get_the_post_thumbnail_url() : ''; $activetab = ($counttab == 0) ? 'active' : ''; $output .= '

'.get_the_title().'

'.taskereasy_custom_excerpt_length(40).'

'.esc_html__("Start Now", "taskereasy").'
'; $counttab++; endwhile; } wp_reset_postdata(); } $output.='
'; } $output .= '
'; return $output; });