HappyFiles para Oxygenados php

                  <?php
$excluidos = array(2,5);

function happyfilesArchivos($id, $cantidad, $orderBy,$orden){

    /***
     * $id = Id de la carpeta
     * $cantidad = Cuantas fotos por carpeta
     * $orderBy puede ser por:
     *      - fecha: 'post_date'
     *      - nombre: 'post_title'
     *      - ID: 'ID' (viene siendo lo mismo que por fecha)
     *
     * */

    $args = array(
    'post_type' => 'attachment',
    'post_mime_type' =>'image',
    'post_status' => 'inherit',
    'posts_per_page' =>$cantidad,
	'order_by' => $orderBy,
	'order' => $orden,
    'tax_query' => array(
        array(
            'taxonomy' => 'happyfiles_category',
            'field'    => 'ID',
            'terms'    => $id,
        ),
    ),
);
$query_images = new WP_Query( $args );
$images = array();

	$salida = '<div class="gallery grid-4-3-2">';
    foreach ( $query_images->posts as $image) {
		$img = wp_get_attachment_image_url( $image->ID, "full");
		$img_thumb = wp_get_attachment_image_url( $image->ID, "thumbnail");
		$caption = wp_get_attachment_caption($image->ID);
		$salida .='<a data-fancybox="'.$id.'" data-src="'.$img.'" data-caption="'.$caption.'">';
		$salida .='<img loading="lazy" src="'.$img_thumb.'" style="max-width:100%;height:auto;" />';
    $salida .='</a>';
    }
    $salida .='</div>';
    wp_reset_postdata();
    echo $salida;
}

function happyfilesCarpetas($no_incluidos) {
    $args = [
        "taxonomy" => "happyfiles_category",
        "orderby" => "name",
        "order" => "ASC",
        "hide_empty" => false,
    ];

    $folders = get_terms( $args );

    foreach ( $folders as $folder ) {
		if (in_array($folder->term_id, $no_incluidos)){
            continue;
        }
		if($folder->count ){
			echo '<h2>'.$folder->name.'</h2>';
			happyfilesArchivos($folder->term_id, 3, 'post_date', 'DESC');
		}
    }
}

  happyfilesCarpetas($excluidos);
?>