Industrial Connectors
Discover our comprehensive range of precision-engineered connectors for automotive, industrial, and specialized applications.
'posts_per_page' => 9,
'paged' => $paged,
'post_status' => 'publish'
];// 添加搜索条件
if ($search) {
$args['s'] = $search;
}
// 添加 meta_query 筛选条件
$meta_query = [];
if ($oem_series) {
$meta_query[] = [
'key' => 'oem_series',
'value' => $oem_series,
'compare' => '='
];
}
if ($product_range) {
$meta_query[] = [
'key' => 'product_range',
'value' => $product_range,
'compare' => '='
];
}
if ($connection_type) {
$meta_query[] = [
'key' => 'connection_type',
'value' => $connection_type,
'compare' => '='
];
}
if ($number_of_positions) {
$meta_query[] = [
'key' => 'number_of_positions',
'value' => $number_of_positions,
'compare' => '='
];
}
if ($male_female) {
$meta_query[] = [
'key' => 'male_female',
'value' => $male_female,
'compare' => '='
];
}
if ($body_color) {
$meta_query[] = [
'key' => 'body_color',
'value' => $body_color,
'compare' => '='
];
}
if ($meta_query) {
$args['meta_query'] = $meta_query;
}
$query = new WP_Query($args);
ob_start();
// 输出连接器网格
echo '
';
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
// 获取字段值
$oem_part = get_field('oem_part_number') ?: '';
$minmax_part = get_field('minmax_part_number') ?: '';
$series = get_field('oem_series') ?: '';
$positions = get_field('number_of_positions') ?: '';
$gender = get_field('male_female') ?: '';
$color = get_field('body_color') ?: '';
echo '
';
// 分页导航
if ($query->max_num_pages > 1) {
echo '
';
}
$html = ob_get_clean();
wp_reset_postdata();
hx_response($html);
exit;
}
?>
';
// 产品图片
echo '
';
}
} else {
echo '
';
// 图片优先级处理
$acf_image = function_exists('get_field') ? get_field('featured_image') : null;
$thumb_id = has_post_thumbnail() ? get_post_thumbnail_id() : 0;
if ($thumb_id) {
$alt = get_post_meta($thumb_id, '_wp_attachment_image_alt', true) ?: get_the_title();
echo wp_get_attachment_image($thumb_id, 'large', false, [
'class' => 'w-full h-full object-cover group-hover:scale-105 transition-transform duration-300',
'loading' => 'lazy',
'decoding' => 'async',
'alt' => esc_attr($alt),
]);
} elseif (is_array($acf_image) && !empty($acf_image['url'])) {
$alt = $acf_image['alt'] ?? get_the_title();
echo '
';
} elseif (is_string($acf_image) && $acf_image) {
echo '
';
} else {
echo '
';
}
echo '
';
// 产品信息
echo '
';
// 标题
echo '
';
echo '
'; echo esc_html(get_the_title()); echo '
'; // 规格信息 echo '
';
if ($oem_part) {
echo '
';
// 标签
echo '
';
echo 'OEM Part:';
echo '' . esc_html($oem_part) . '';
echo '
';
}
if ($minmax_part) {
echo '
';
echo 'Minmax Part:';
echo '' . esc_html($minmax_part) . '';
echo '
';
}
if ($series) {
echo '
';
echo 'Series:';
echo '' . esc_html($series) . '';
echo '
';
}
if ($positions) {
echo '
';
echo 'Positions:';
echo '' . esc_html($positions) . '';
echo '
';
}
echo '
';
if ($gender) {
echo '';
echo esc_html($gender);
echo '';
}
if ($color) {
echo '';
echo esc_html($color);
echo '';
}
echo '
';
// 查看详情按钮
echo '';
echo 'View Details';
echo '';
echo '
';
echo '
';
}
echo '
🔌
';
echo '
No Connectors Found
'; echo 'Try adjusting your search criteria or browse all products.
'; echo '"
hx-get="/wp-json/zeroy/v1/htmx/execute/current?block_id="
hx-trigger="load"
hx-indicator="#loading-block_8w5plmza">
Loading connectors...
Loading...