category-21.php 1.44 KB
Newer Older
root's avatar
root committed
1 2
<?php

root's avatar
root committed
3 4
$maxMembersPerLine = 3;

root's avatar
root committed
5 6 7 8 9 10 11 12

get_header();

?>

<ul>

    <?php
root's avatar
root committed
13 14 15 16 17 18 19 20 21 22 23 24
    $order = "asc";


    $currentCategoryID = explode("=",$_SERVER['REQUEST_URI'])[1];

    $category = get_the_category_by_id($currentCategoryID);






root's avatar
root committed
25

root's avatar
root committed
26 27 28


    if (isset($_GET["order"])) {
root's avatar
root committed
29 30
        $order = $_GET["order"];

root's avatar
root committed
31 32
        if ($order != "asc" && $order != "desc") {
            $order = "asc";
root's avatar
root committed
33 34 35 36
        }
    }

    global $post;
root's avatar
root committed
37
    $args = array('posts_per_page' => 10, 'offset' => 0, 'cat' => $currentCategoryID, 'orderby' => 'title', 'order' => $order);
root's avatar
root committed
38 39 40 41 42 43

    ?>

    <?php

    $myposts = get_posts($args);
root's avatar
root committed
44 45 46 47 48 49 50 51
    echo "<br>";


    $count = 0;
    childrens_of_member_category($category);
    echo "<div class='adullact-members-list'>";

    echo "<div class='adullact-line'>";
root's avatar
root committed
52 53 54
    foreach ($myposts as $post) : setup_postdata($post);
        $id = get_the_id();
        $url = get_metadata("post", $id, "project_url")[0];
root's avatar
root committed
55
        $count +=1;
root's avatar
root committed
56 57 58
        ?>


root's avatar
root committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
        <a href="<?php echo $url; ?>" target="_blank" class="adullact-member">
            <?php the_post_thumbnail(array("200", "200")); ?> <br>
            <?php the_title(); ?> <br>
            <?php the_tags($before = ''); ?>
        </a>

        <?php
        if ($count >= $maxMembersPerLine) {
            $count = 0;
            echo "</div>";
            echo "<div class='adullact-line'>";
        }

    endforeach;
    echo "</div></div>";

root's avatar
root committed
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
    wp_reset_postdata(); ?>

</ul>


<?php

//get_sidebar();

get_footer();

?>