homegrade_theme_production/includes/utilities.php

45 lines
895 B
PHP

<?php
function getThematiqueFamilySlug($thematique_slug)
{
switch ($thematique_slug) {
case "energie":
case "urbanisme":
return "energies-urbanisme";
case "acoustique":
case "petites-coproprietes":
return "acoustique-coproprietes";
case "isolation":
case "au-quotidien":
return "isolation-quotidien";
case "energies":
case "urbanisme":
return "energies-urbanisme";
case "patrimoine":
case "renovation":
return "patrimoine-renovation";
case "location":
return "location";
}
}
// Get automatic post used in BLOCK QUESTIONS FREQUENTES
function get_automatic_post($post_type)
{
$automatic_query_args = array(
'numberposts' => 2,
'post_per_page' => 1,
'post_status' => 'publish',
'post_type' => 'fiche-questions',
'thematiques' => $post_type,
);
return get_posts($automatic_query_args)[0];
}