Commit ea963684 authored by root's avatar root

add: formatting members list

parent 4ea4fc19
<?php <?php
$maxMembersPerLine = 3;
get_header(); get_header();
...@@ -8,41 +10,68 @@ get_header(); ...@@ -8,41 +10,68 @@ get_header();
<ul> <ul>
<?php <?php
$order="asc"; $order = "asc";
childrens_of_member_category();
$currentCategoryID = explode("=",$_SERVER['REQUEST_URI'])[1];
$category = get_the_category_by_id($currentCategoryID);
if (isset($_GET["order"])){
if (isset($_GET["order"])) {
$order = $_GET["order"]; $order = $_GET["order"];
if ($order!="asc" && $order != "desc"){ if ($order != "asc" && $order != "desc") {
$order="asc"; $order = "asc";
} }
} }
global $post; global $post;
$args = array('posts_per_page' => 10, 'offset' => 0, 'category_name' => 'adherent', 'orderby' => 'title', 'order' => $order); $args = array('posts_per_page' => 10, 'offset' => 0, 'cat' => $currentCategoryID, 'orderby' => 'title', 'order' => $order);
?> ?>
<?php <?php
//echo "url : " . $_SERVER['REQUEST_URI'];
$myposts = get_posts($args); $myposts = get_posts($args);
echo "<br>";
$count = 0;
childrens_of_member_category($category);
echo "<div class='adullact-members-list'>";
echo "<div class='adullact-line'>";
foreach ($myposts as $post) : setup_postdata($post); foreach ($myposts as $post) : setup_postdata($post);
$id = get_the_id(); $id = get_the_id();
$url = get_metadata("post", $id, "project_url")[0]; $url = get_metadata("post", $id, "project_url")[0];
$count +=1;
?> ?>
<li>
<a href="<?php echo $url; ?>" target="_blank"> <a href="<?php echo $url; ?>" target="_blank" class="adullact-member">
<?php the_post_thumbnail(array("200", "200")); ?> <br> <?php the_post_thumbnail(array("200", "200")); ?> <br>
<?php the_title(); ?> <br> <?php the_title(); ?> <br>
<?php the_tags($before = ''); ?> <?php the_tags($before = ''); ?>
</a> </a>
</li>
<?php endforeach; <?php
if ($count >= $maxMembersPerLine) {
$count = 0;
echo "</div>";
echo "<div class='adullact-line'>";
}
endforeach;
echo "</div></div>";
wp_reset_postdata(); ?> wp_reset_postdata(); ?>
</ul> </ul>
......
<?php <?php
$maxMembersPerLine = 3;
get_header(); get_header();
...@@ -8,41 +10,67 @@ get_header(); ...@@ -8,41 +10,67 @@ get_header();
<ul> <ul>
<?php <?php
$order="asc"; $order = "asc";
childrens_of_member_category();
$currentCategoryID = explode("=",$_SERVER['REQUEST_URI'])[1];
$category = get_the_category_by_id($currentCategoryID);
childrens_of_member_category($category);
if (isset($_GET["order"])){
if (isset($_GET["order"])) {
$order = $_GET["order"]; $order = $_GET["order"];
if ($order!="asc" && $order != "desc"){ if ($order != "asc" && $order != "desc") {
$order="asc"; $order = "asc";
} }
} }
global $post; global $post;
$args = array('posts_per_page' => 10, 'offset' => 0, 'category_name' => 'epci-mutualisant', 'orderby' => 'title', 'order' => $order); $args = array('posts_per_page' => 10, 'offset' => 0, 'cat' => $currentCategoryID, 'orderby' => 'title', 'order' => $order);
?> ?>
<?php <?php
//echo "url : " . $_SERVER['REQUEST_URI'];
$myposts = get_posts($args); $myposts = get_posts($args);
echo "<br>";
$count = 0;
echo "<div class='adullact-members-list'>";
echo "<div class='adullact-line'>";
foreach ($myposts as $post) : setup_postdata($post); foreach ($myposts as $post) : setup_postdata($post);
$id = get_the_id(); $id = get_the_id();
$url = get_metadata("post", $id, "project_url")[0]; $url = get_metadata("post", $id, "project_url")[0];
$count +=1;
?> ?>
<li>
<a href="<?php echo $url; ?>" target="_blank"> <a href="<?php echo $url; ?>" target="_blank" class="adullact-member">
<?php the_post_thumbnail(array("200", "200")); ?> <br> <?php the_post_thumbnail(array("200", "200")); ?> <br>
<?php the_title(); ?> <br> <?php the_title(); ?> <br>
<?php the_tags($before = ''); ?> <?php the_tags($before = ''); ?>
</a> </a>
</li>
<?php endforeach; <?php
if ($count >= $maxMembersPerLine) {
$count = 0;
echo "</div>";
echo "<div class='adullact-line'>";
}
endforeach;
echo "</div></div>";
wp_reset_postdata(); ?> wp_reset_postdata(); ?>
</ul> </ul>
......
<?php <?php
$maxMembersPerLine = 3;
get_header(); get_header();
...@@ -8,41 +10,67 @@ get_header(); ...@@ -8,41 +10,67 @@ get_header();
<ul> <ul>
<?php <?php
$order="asc"; $order = "asc";
childrens_of_member_category();
$currentCategoryID = explode("=",$_SERVER['REQUEST_URI'])[1];
$category = get_the_category_by_id($currentCategoryID);
childrens_of_member_category($category);
if (isset($_GET["order"])){
if (isset($_GET["order"])) {
$order = $_GET["order"]; $order = $_GET["order"];
if ($order!="asc" && $order != "desc"){ if ($order != "asc" && $order != "desc") {
$order="asc"; $order = "asc";
} }
} }
global $post; global $post;
$args = array('posts_per_page' => 10, 'offset' => 0, 'category_name' => 'ville', 'orderby' => 'title', 'order' => $order); $args = array('posts_per_page' => 10, 'offset' => 0, 'cat' => $currentCategoryID, 'orderby' => 'title', 'order' => $order);
?> ?>
<?php <?php
//echo "url : " . $_SERVER['REQUEST_URI'];
$myposts = get_posts($args); $myposts = get_posts($args);
echo "<br>";
$count = 0;
echo "<div class='adullact-members-list'>";
echo "<div class='adullact-line'>";
foreach ($myposts as $post) : setup_postdata($post); foreach ($myposts as $post) : setup_postdata($post);
$id = get_the_id(); $id = get_the_id();
$url = get_metadata("post", $id, "project_url")[0]; $url = get_metadata("post", $id, "project_url")[0];
$count +=1;
?> ?>
<li>
<a href="<?php echo $url; ?>" target="_blank"> <a href="<?php echo $url; ?>" target="_blank" class="adullact-member">
<?php the_post_thumbnail(array("200", "200")); ?> <br> <?php the_post_thumbnail(array("200", "200")); ?> <br>
<?php the_title(); ?> <br> <?php the_title(); ?> <br>
<?php the_tags($before = ''); ?> <?php the_tags($before = ''); ?>
</a> </a>
</li>
<?php endforeach; <?php
if ($count >= $maxMembersPerLine) {
$count = 0;
echo "</div>";
echo "<div class='adullact-line'>";
}
endforeach;
echo "</div></div>";
wp_reset_postdata(); ?> wp_reset_postdata(); ?>
</ul> </ul>
......
<?php <?php
$maxMembersPerLine = 3;
get_header(); get_header();
...@@ -8,41 +10,67 @@ get_header(); ...@@ -8,41 +10,67 @@ get_header();
<ul> <ul>
<?php <?php
$order="asc"; $order = "asc";
childrens_of_member_category();
$currentCategoryID = explode("=",$_SERVER['REQUEST_URI'])[1];
$category = get_the_category_by_id($currentCategoryID);
childrens_of_member_category($category);
if (isset($_GET["order"])){
if (isset($_GET["order"])) {
$order = $_GET["order"]; $order = $_GET["order"];
if ($order!="asc" && $order != "desc"){ if ($order != "asc" && $order != "desc") {
$order="asc"; $order = "asc";
} }
} }
global $post; global $post;
$args = array('posts_per_page' => 10, 'offset' => 0, 'category_name' => 'association', 'orderby' => 'title', 'order' => $order); $args = array('posts_per_page' => 10, 'offset' => 0, 'cat' => $currentCategoryID, 'orderby' => 'title', 'order' => $order);
?> ?>
<?php <?php
//echo "url : " . $_SERVER['REQUEST_URI'];
$myposts = get_posts($args); $myposts = get_posts($args);
echo "<br>";
$count = 0;
echo "<div class='adullact-members-list'>";
echo "<div class='adullact-line'>";
foreach ($myposts as $post) : setup_postdata($post); foreach ($myposts as $post) : setup_postdata($post);
$id = get_the_id(); $id = get_the_id();
$url = get_metadata("post", $id, "project_url")[0]; $url = get_metadata("post", $id, "project_url")[0];
$count +=1;
?> ?>
<li>
<a href="<?php echo $url; ?>" target="_blank"> <a href="<?php echo $url; ?>" target="_blank" class="adullact-member">
<?php the_post_thumbnail(array("200", "200")); ?> <br> <?php the_post_thumbnail(array("200", "200")); ?> <br>
<?php the_title(); ?> <br> <?php the_title(); ?> <br>
<?php the_tags($before = ''); ?> <?php the_tags($before = ''); ?>
</a> </a>
</li>
<?php endforeach; <?php
if ($count >= $maxMembersPerLine) {
$count = 0;
echo "</div>";
echo "<div class='adullact-line'>";
}
endforeach;
echo "</div></div>";
wp_reset_postdata(); ?> wp_reset_postdata(); ?>
</ul> </ul>
......
...@@ -8,24 +8,31 @@ function my_theme_enqueue_styles() ...@@ -8,24 +8,31 @@ function my_theme_enqueue_styles()
} }
function childrens_of_member_category() function childrens_of_member_category($category)
{ {
//cette fonction affiche la liste des catégories enfants de la catégorie mère Adhérent //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 $childrens = get_term_children(21, "category"); //contiendra les id de tous les enfants de adhérent
if ($category == "Adhérent") {
echo " <a href='?cat=21' class='adullact-sort-button adullact-selected'>Tout</a>";
} else {
echo " <a href='?cat=21' class='adullact-sort-button'>Tout</a>";
}
?> ?>
<a href='?cat=21'>Tout</a>
<?php <?php
foreach ($childrens as $c) { foreach ($childrens as $c) {
$category = get_category($c); //objet contenant les infos de la catégorie enfant $temp_category = get_category($c); //objet contenant les infos de la catégorie enfant
?> ?>
<a href='?cat=<?php echo $c; ?>'> <a
<?php echo $category->name; ?> href='?cat=<?php echo $c; ?>' class="adullact-sort-button <?php if ($temp_category->name == $category) {
echo "adullact-selected";
} ?>">
<?php echo $temp_category->name; ?>
</a> </a>
...@@ -44,13 +51,33 @@ function childrens_of_member_category() ...@@ -44,13 +51,33 @@ function childrens_of_member_category()
function sort_page() function sort_page()
{ {
$link = explode("&order",$_SERVER['REQUEST_URI'])[0] $link = $_SERVER['REQUEST_URI'];
?>
$cleanLink = explode("&order", $link)[0];
if (strpos($link, "order=desc")) {
?>
<a href="<?php echo $cleanLink; ?>&order=asc" class="adullact-sort-button">
Croissant
</a>
<a href="<?php echo $cleanLink; ?>&order=desc" class="adullact-sort-button adullact-selected">
Décroissant
</a>
<?php
} else {
?>
<a href="<?php echo $cleanLink; ?>&order=asc" class="adullact-sort-button adullact-selected">
Croissant
</a>
<a href="<?php echo $cleanLink; ?>&order=desc" class="adullact-sort-button">
Décroissant
</a>
<?php
}
<a href="<?php echo $link; ?>&order=asc">Croissant</a>
<a href="<?php echo $link; ?>&order=desc">Décroissant</a>
<?php
} }
?> ?>
\ No newline at end of file
...@@ -7,3 +7,35 @@ ...@@ -7,3 +7,35 @@
Template: twentyseventeen Template: twentyseventeen
Version: 0.8 Version: 0.8
*/ */
.adullact-members-list{
display:flex;
flex-direction: column;
margin-top:30px;
}
.adullact-line{
display:flex;
flex-direction:row;
justify-content: flex-start;
}
.adullact-member{
max-width:200px;
word-wrap: break-spaces;
text-align:center;
}
.adullact-sort-button{
padding:5px;
border-radius:3px;
border:1px solid grey;
color:grey;
margin:7px;
}
.adullact-selected{
color:black;
border:1px solid black;
}
\ No newline at end of file
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