[insert_php]
'shop_order',
'posts_per_page' => -1,
'post_status' => array('wc-processing', 'wc-completed'),
'date_query' => array(
array(
'column' => 'post_date',
'after' => $start_date,
'before' => $end_date,
),
),
);
$orders = new WP_Query($args);
if ($orders->have_posts()) :
while ($orders->have_posts()) : $orders->the_post();
$order_id = get_the_ID();
$order = wc_get_order($order_id);
// Display order details here
echo '
Order #' . $order->get_order_number() . '
'; echo 'Order Date: ' . $order->get_date_created()->format('Y-m-d H:i:s') . '
'; // Display thumbnails of order attachments (JPG or PNG) $attachments = get_posts(array( 'post_type' => 'attachment', 'post_mime_type' => array('image/jpeg', 'image/png'), 'posts_per_page' => -1, 'post_parent' => $order_id, )); if ($attachments) { echo ' '; } endwhile; else : echo 'No orders found for the selected date range.'; endif; wp_reset_postdata(); get_footer(); ?> [/insert_php]