‘post’,
‘post_status’ => ‘publish’,
‘posts_per_page’ => 12,
‘paged’ => $paged,
‘orderby’ => ‘date’,
‘order’ => ‘DESC’,
];
if (!empty($search_query)) { $query_args[‘s’] = $search_query; }
if (!empty($selected_cat)) { $query_args[‘category_name’] = $selected_cat; }
if (!empty($selected_tag)) { $query_args[‘tag’] = $selected_tag; }
$the_query = new WP_Query($query_args);
ob_start();
if ($the_query->have_posts()) {
echo ‘
while ($the_query->have_posts()) {
$the_query->the_post();
$post_id = get_the_ID();
$title = esc_html(get_the_title());
$permalink = esc_url(get_permalink());
$date = esc_html(get_the_date(‘M j, Y’));
$excerpt = esc_html(wp_trim_words(get_the_excerpt(), 22, ‘…’));
if (has_post_thumbnail($post_id)) {
$thumb_id = get_post_thumbnail_id($post_id);
$thumb_img = wp_get_attachment_image($thumb_id, ‘medium_large’, false, [
‘class’ => ‘w-full h-full object-cover hover:scale-105 transition-transform duration-500’,
‘loading’ => ‘lazy’,
‘sizes’ => ‘(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw’,
‘alt’ => $title,
]);
} else {
$thumb_img = ‘‘;
}
$cats = get_the_category($post_id);
$cat_html = ”;
if (!empty($cats)) {
$cat_name = esc_html($cats[0]->name);
$cat_html = ‘‘ . $cat_name . ‘‘;
}
$tags = get_the_tags($post_id);
$tag_html = ”;
if (!empty($tags) && !is_wp_error($tags)) {
foreach (array_slice($tags, 0, 2) as $tag) {
$tag_html .= ‘‘ . esc_html($tag->name) . ‘‘;
}
}
$read_label = ‘Read full article: ‘ . esc_attr($title);
echo <<
HTML;
}
echo ‘
‘;
$total_pages = $the_query->max_num_pages;
$current_page = $paged;
if ($total_pages > 1) {
$base_params = [‘block_id’ => $block_id];
if (!empty($search_query)) { $base_params[‘s’] = $search_query; }
if (!empty($selected_cat)) { $base_params[‘cat’] = $selected_cat; }
if (!empty($selected_tag)) { $base_params[‘tag’] = $selected_tag; }
$results_id = ‘results-‘ . $block_id;
$spinner_id = ‘spinner-‘ . $block_id;
echo ‘
‘;
}
} else {
echo <<<'HTML'
No articles found
Try adjusting your search terms or clearing the filters to browse all posts.
HTML;
}
wp_reset_postdata();
$html = ob_get_clean();
hx_response($html);
}
?>
iSUKERR Blog
Audio Industry
Insights & Guides
Expert articles on headphone technology, OEM/ODM development, product selection, and audio manufacturing — written for brand owners and wholesalers.
Loading articles…