working on getPostMainThematique escapements
This commit is contained in:
parent
4823dd6378
commit
ccccbf238e
|
|
@ -74,10 +74,16 @@ function getMainThematique($thematique)
|
|||
return get_term($thematique->parent, 'thematiques');
|
||||
}
|
||||
}
|
||||
// DOES THE SAME THING AS ABOVE BUT RENAMED
|
||||
// Retriev the main thematique for a spefic postID
|
||||
function getPostMainThematique($post)
|
||||
{
|
||||
return getMainThematique(get_the_terms($post, "thematiques")[0]);
|
||||
$terms = get_the_terms($post, "thematiques");
|
||||
if (!$terms) return null;
|
||||
|
||||
$mainThematique = getMainThematique(get_the_terms($post, "thematiques")[0]);
|
||||
if (!$mainThematique) return null;
|
||||
|
||||
return $mainThematique;
|
||||
}
|
||||
|
||||
// TO GET ARCHIVE RELATED PAGES BY TEMPLATE
|
||||
|
|
@ -137,9 +143,16 @@ function compareThematiquePriority($postA, $postB)
|
|||
$thematiqueA = getPostMainThematique($postA);
|
||||
$thematiqueB = getPostMainThematique($postB);
|
||||
|
||||
if ($priorityA == $priorityB) {
|
||||
|
||||
write_log('############## post A');
|
||||
// write_log($postA);
|
||||
write_log("####" . $thematiqueA->name);
|
||||
if ($priorityA == $priorityB && $thematiqueA->name != $thematiqueB->name) {
|
||||
return strcmp($thematiqueA->name, $thematiqueB->name);
|
||||
}
|
||||
if ($priorityA == $priorityB && $thematiqueA->name == $thematiqueB->name) {
|
||||
return strcmp($postA->title, $postB->title);
|
||||
}
|
||||
if ($priorityA < $priorityB) {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user