recent work section. * * @package business-class */ /** * Exit if accessed directly. */ if ( ! defined( 'ABSPATH' ) ) { exit; } $panel_name = 'front_page'; $section_name = 'recent_works'; $enable_section = business_class_get_theme_mod( $panel_name, $section_name, 'Enable Section' ); if ( ! $enable_section ) { return; } $all_terms = array(); $heading = business_class_get_theme_mod( $panel_name, $section_name, 'heading' ); $sub_heading = business_class_get_theme_mod( $panel_name, $section_name, 'sub_heading' ); $categories = business_class_get_theme_mod( $panel_name, $section_name, 'Select Category' ); $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array( // phpcs:ignore array( 'taxonomy' => 'category', 'field' => 'term_id', 'terms' => array(), ), ), ); if ( is_array( $categories ) && ! empty( $categories ) ) { foreach ( $categories as $key => $term_id ) { $all_terms[ $key ] = get_term_by( 'term_id', $term_id, 'category', ARRAY_A ); array_push( $args['tax_query'][0]['terms'], $term_id ); } } $the_query = new WP_Query( $args ); ?>