FEATURE Handling different types multiple taxonomies
This commit is contained in:
parent
7205e75f89
commit
e8b7520ef5
|
|
@ -120,7 +120,7 @@ function get_last_analyses_etudes_posts()
|
||||||
'order' => 'DESC',
|
'order' => 'DESC',
|
||||||
'tax_query' => array(
|
'tax_query' => array(
|
||||||
array(
|
array(
|
||||||
'taxonomy' => 'type',
|
'taxonomy' => 'type-analyse-etude',
|
||||||
'field' => 'slug',
|
'field' => 'slug',
|
||||||
'terms' => 'analyse',
|
'terms' => 'analyse',
|
||||||
),
|
),
|
||||||
|
|
@ -134,7 +134,7 @@ function get_last_analyses_etudes_posts()
|
||||||
'order' => 'DESC',
|
'order' => 'DESC',
|
||||||
'tax_query' => array(
|
'tax_query' => array(
|
||||||
array(
|
array(
|
||||||
'taxonomy' => 'type',
|
'taxonomy' => 'type-analyse-etude',
|
||||||
'field' => 'slug',
|
'field' => 'slug',
|
||||||
'terms' => 'etude',
|
'terms' => 'etude',
|
||||||
),
|
),
|
||||||
|
|
@ -273,3 +273,53 @@ function count_user_posts_by_author($userID, $postType)
|
||||||
$query = new WP_Query($args);
|
$query = new WP_Query($args);
|
||||||
return $query->found_posts;
|
return $query->found_posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_activity_title_from_acf_layout_label($label)
|
||||||
|
{
|
||||||
|
switch ($label) {
|
||||||
|
case 'public_cible':
|
||||||
|
return __('Public cible', 'carhop');
|
||||||
|
case 'lieu':
|
||||||
|
return __('Lieu', 'carhop');
|
||||||
|
case 'date':
|
||||||
|
return __('Date', 'carhop');
|
||||||
|
case 'duree':
|
||||||
|
return __('Durée', 'carhop');
|
||||||
|
case 'prix':
|
||||||
|
return __('Prix', 'carhop');
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_post_type_supports_type($post_type)
|
||||||
|
{
|
||||||
|
switch ($post_type) {
|
||||||
|
case 'activites':
|
||||||
|
case 'analyses-etudes':
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_post_specific_type_terms($post_id)
|
||||||
|
{
|
||||||
|
$post_type = get_post_type($post_id);
|
||||||
|
$terms = null;
|
||||||
|
|
||||||
|
switch ($post_type) {
|
||||||
|
case 'activites':
|
||||||
|
$terms = get_the_terms($post_id, 'type-activite');
|
||||||
|
|
||||||
|
return $terms;
|
||||||
|
case 'analyses-etudes':
|
||||||
|
$terms = get_the_terms($post_id, 'type-analyse-etude');
|
||||||
|
return $terms;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $terms;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user