'.$title.'

'.$desc.'

'; //end of row $product.='
'; // start all category $product.='
'; $the_query = new WP_Query( array ( 'category_name'=>$cat ) ); while ( $the_query->have_posts()): $the_query->the_post(); $featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'swiftpress-products' ); $featured_image = $featured_image[0]; $title = get_the_title(); $args = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all','parent' => $catId,); $term =wp_get_post_terms(get_the_ID(),'category',$args); foreach ($term as $terms) { $term_name = $terms->name; } $product.='
'; if ( !has_post_thumbnail() ) { $product.=''; } else{ $product.=''; } $product.='
'; endwhile; wp_reset_postdata(); $product.='
'; //end all category $counter=0; $category = get_category_by_slug( $cat ); $args = array( 'type' => 'post', 'child_of' => $category->term_id, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => FALSE, 'hierarchical' => 1, 'taxonomy' => 'category', ); $termchildren = get_categories($args ); foreach($termchildren as $termchildren): $term_name = $termchildren->name; $term_slug = $termchildren->slug; $counter++; if($counter==1){ $active="active"; }else{ $active=""; } $product.='
'; $the_query = new WP_Query( array ('category_name'=>$term_slug ) ); while ( $the_query->have_posts()): $the_query->the_post(); $featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'swiftpress-products' ); $featured_image = $featured_image[0]; $product.='
'; if ( !has_post_thumbnail() ) { $product.=''; } else{ $product.=''; } $product.='
'; endwhile; wp_reset_postdata(); $product.='
'; endforeach; $product.='
'; echo $product; }?>