$active_term_id = 13;
$categorie = getTechFields($active_term_id);
if ( empty($categorie) ) {
$args = array(
'post_status' => 'publish',
'posts_per_page' => -1,
'post_type' => 'technologies',
'tax_query' => array(
array(
'taxonomy' => 'tech_fields',
'field' => 'id',
'terms' => $active_term_id,
)
),
'orderby' => 'title',
'order' => ASC
);
$technologies = get_posts($args);
foreach ($technologies as $technology) {
$IDTechnology = $technology->ID;
$technology_title = $technology->post_title;
$technology_permalink = get_permalink($IDTechnology);
$technology_picture = wp_get_attachment_image_src( get_post_thumbnail_id($IDTechnology), 'medium', false );
$technology_picture = $technology_picture[0];
$technology_details = get_field('product_detail', $IDTechnology);
$technology_short_description = get_field('short_description', $IDTechnology);
$technology_brochure = get_field('attached', $IDTechnology);
var_dump($technology_title);
}
} else {
foreach ($categorie as $categoria) {
$IDCategoria = $categoria->term_id;
$args = array(
'post_status' => 'publish',
'posts_per_page' => -1,
'post_type' => 'technologies',
'tax_query' => array(
array(
'taxonomy' => 'tech_fields',
'field' => 'id',
'terms' => $IDCategoria,
)
),
'orderby' => 'title',
'order' => ASC
);
$technologies = get_posts($args);
foreach ($technologies as $technology) {
$IDTechnology = $technology->ID;
$technology_title = $technology->post_title;
$technology_permalink = get_permalink($IDTechnology);
$technology_picture = wp_get_attachment_image_src( get_post_thumbnail_id($IDTechnology), 'medium', false );
$technology_picture = $technology_picture[0];
$technology_details = get_field('product_detail', $IDTechnology);
$technology_short_description = get_field('short_description', $IDTechnology);
$technology_brochure = get_field('attached', $IDTechnology);
var_dump($technology_title);
}
}
}
?>