Commit 7c24a7d4 authored by Nathan Peraldi's avatar Nathan Peraldi

edit sort buttons for member list

parent 8cddb1cb
......@@ -7,28 +7,43 @@ function my_theme_enqueue_styles()
}
function childrens_of_member_category($category)
function childrens_of_member_category($category_to_select)
{
//cette fonction affiche la liste des catégories enfants de la catégorie mère Adhérent
$childrens = get_term_children(21, "category"); //contiendra les id de tous les enfants de adhérent
$member_category_object = get_category_by_slug("adherent");
if ($category == "Adhérent" || $category == "") {
echo " <a href='?cat=21' class='adullact-sort-button adullact-selected'>Tout</a>";
$id = $member_category_object->cat_ID;
$server_link = $_SERVER["SERVER_NAME"];
$link_Category = "http://" . $server_link . "/category/";
$current_category=explode("/", $_SERVER['REQUEST_URI'])[2];
dump_debug($_SERVER);
echo_debug("\n----------------------\n");
dump_debug($member_category_object);
//SERVER_NAME
$childrens = get_term_children($id, "category"); //contiendra les id de tous les enfants de adhérent
if ($current_category == "adherent" || $current_category == "") {
echo " <a href='" . $link_Category . "adherent/' class='adullact-sort-button adullact-selected'>Tout</a>";
} else {
echo " <a href='?cat=21' class='adullact-sort-button'>Tout</a>";
echo " <a href='" . $link_Category . "adherent/' class='adullact-sort-button'>Tout</a>";
}
foreach ($childrens as $c) {
$temp_category = get_category($c); //objet contenant les infos de la catégorie enfant
$my_link = "<a href=\"?cat=";
$my_link .= $c;
$my_link = "<a href = \"http://" . $server_link . "/category/";
$my_link .= $temp_category->slug;
$my_link .= "\" class=\"adullact-sort-button";
if ($temp_category->name == $category) {
if ($temp_category->slug == $category_to_select) {
//si on est en train d'afficher la catégorie sélectionnée
$my_link .= " adullact-selected";
}
else{
echo_debug($temp_category->slug . "=/=" . $category_to_select);
}
$my_link .= "\">";
$my_link .= $temp_category->name;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment