90 lines
1.8 KiB
PHP
90 lines
1.8 KiB
PHP
<?php
|
|
function getThematiqueFamilySlug($thematique_slug)
|
|
{
|
|
if (!$thematique_slug) {
|
|
return null;
|
|
}
|
|
switch ($thematique_slug) {
|
|
case "energie":
|
|
case "urbanisme":
|
|
return "energies-urbanisme";
|
|
|
|
case "acoustique":
|
|
case "akoestiek":
|
|
case "petites-coproprietes":
|
|
case "kleine-mede-eigendommen":
|
|
return "acoustique-coproprietes";
|
|
|
|
case "isolation":
|
|
case "isolatie":
|
|
case "au-quotidien":
|
|
return "isolation-quotidien";
|
|
|
|
case "energies":
|
|
case "urbanisme":
|
|
case "stedenbouw":
|
|
return "energies-urbanisme";
|
|
|
|
case "patrimoine":
|
|
case "erfgoed":
|
|
case "renovation":
|
|
return "patrimoine-renovation";
|
|
|
|
case "location":
|
|
case "renovation-circulaire":
|
|
case "verhuur":
|
|
return "location-renovation-circulaire";
|
|
}
|
|
}
|
|
|
|
function getParentThematique($thematique)
|
|
{
|
|
if (!$thematique) {
|
|
return null;
|
|
}
|
|
|
|
if ($thematique->parent == 0) {
|
|
return $thematique;
|
|
} else {
|
|
return get_term($thematique->parent, 'thematiques');
|
|
}
|
|
}
|
|
|
|
// DOES THE SAME THING AS ABOVE BUT RENAMED
|
|
function getMainThematique($thematique)
|
|
{
|
|
if (!$thematique) {
|
|
return null;
|
|
}
|
|
|
|
if ($thematique->parent == 0) {
|
|
return $thematique;
|
|
} else {
|
|
return get_term($thematique->parent, 'thematiques');
|
|
}
|
|
}
|
|
|
|
|
|
// Get automatic post used in BLOCK QUESTIONS FREQUENTES
|
|
function get_automatic_post($post_type)
|
|
{
|
|
$automatic_query_args = array(
|
|
'post_per_page' => 1,
|
|
'post_status' => 'publish',
|
|
'post_type' => 'questions',
|
|
'thematiques' => $post_type,
|
|
);
|
|
return get_posts($automatic_query_args)[0];
|
|
}
|
|
|
|
|
|
// TO GET ARCHIVE RELATED PAGES BY TEMPLATE
|
|
function get_page_by_template($template = '')
|
|
{
|
|
$args = array(
|
|
'meta_key' => '_wp_page_template',
|
|
'meta_value' => $template
|
|
);
|
|
return get_pages($args);
|
|
}
|