Commit 9546e3d1 authored by Nathan Peraldi's avatar Nathan Peraldi

move php tag for better logic

parent d2a3945a
......@@ -55,75 +55,75 @@ $max_member_numero = ($page * $maxMembersPerPage);
</ul>
</div>
</div>
<?php echo "<div class='adullact-members-list'>";
<div class='adullact-members-list'>
<?php
$args = array(
"post_type" => "page",
"order" => $order,
"category_name" => $category,
"orderby" => "title",
"posts_per_page" => -1);
$mypages = get_posts($args);
$args = array(
"post_type" => "page",
"order" => $order,
"category_name" => $category,
"orderby" => "title",
"posts_per_page" => -1);
$mypages = get_posts($args);
$number_of_total_posts = count($mypages); //pour les pages
if (($number_of_total_posts == 0) || ($number_of_total_posts < $min_member_numero)) {
echo "<h3>Aucun résultat.</h3>";
$pagination = false;
} else {
$counter = 1;
foreach ($mypages as $post) : setup_postdata($post);
if ($counter >= $min_member_numero) {
if ($counter <= $max_member_numero) {
$id = get_the_id();
$url = get_metadata("post", $id, "project_url")[0];
$number_of_total_posts = count($mypages); //pour les pages
if (($number_of_total_posts == 0) || ($number_of_total_posts < $min_member_numero)) {
echo "<h3>Aucun résultat.</h3>";
$pagination = false;
} else {
$counter = 1;
foreach ($mypages as $post) : setup_postdata($post);
if ($counter >= $min_member_numero) {
if ($counter <= $max_member_numero) {
$id = get_the_id();
$url = get_metadata("post", $id, "project_url")[0];
?>
<div class="adullact-member">
<div>
<a href="<?php echo $url; ?>" target="_blank">
<?php the_post_thumbnail(array("200", "200")); ?> <br>
</a>
</div>
?>
<div class="adullact-member">
<div>
<a href="<?php echo $url; ?>" target="_blank">
<?php the_post_thumbnail(array("200", "200")); ?> <br>
</a>
<p><?php the_title(); ?></p><br>
</div>
<p><?php the_title(); ?></p><br>
</div>
<?php
} else {
//on a dépassé le nombre max d'adhérents à afficher, on peut donc stopper la boucle car elle n'affichera plus rien.
break;
<?php
} else {
//on a dépassé le nombre max d'adhérents à afficher, on peut donc stopper la boucle car elle n'affichera plus rien.
break;
}
}
}
$counter += 1;
endforeach;
echo "</div></div>";
wp_reset_postdata();
}
$counter += 1;
endforeach;
echo "</div></div>";
wp_reset_postdata();
}
if ($pagination) {
?>
<div class="pagination">
<?php
if ($pagination) {
?>
<div class="pagination">
<?php
$number_of_pages_to_generate = intdiv($number_of_total_posts, $maxMembersPerPage);
$reste = $number_of_total_posts % $maxMembersPerPage;
$number_of_pages_to_generate = intdiv($number_of_total_posts, $maxMembersPerPage);
$reste = $number_of_total_posts % $maxMembersPerPage;
if ($reste > 0) {
$number_of_pages_to_generate += 1;
}
if ($reste > 0) {
$number_of_pages_to_generate += 1;
}
for ($i = 1; $i <= $number_of_pages_to_generate; $i++) {
$page_link = $link . "?page=" . $i . "&order=" . $order;
$link_class = "adullact-page-link";
if ($page == $i) {
$link_class .= " adullact-page-link-selected";
for ($i = 1; $i <= $number_of_pages_to_generate; $i++) {
$page_link = $link . "?page=" . $i . "&order=" . $order;
$link_class = "adullact-page-link";
if ($page == $i) {
$link_class .= " adullact-page-link-selected";
}
?>
<a href="<?php echo $page_link ?>" class="<?php echo $link_class ?>"><?php echo $i ?></a>
<?php
}
?>
<a href="<?php echo $page_link ?>" class="<?php echo $link_class ?>"><?php echo $i ?></a>
<?php
}
?>
</div>
<?php } ?>
</div>
<?php } ?>
</main>
</div>
<?php get_footer(); ?>
\ 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