-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive-termine.php
executable file
·42 lines (34 loc) · 1.24 KB
/
archive-termine.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php get_header(); ?>
<div id="content" class="container">
<h1 class="page-title">Glossario</h1>
<?php
$terms_alphabetical = new WP_Query(array(
'post_type' => 'termine',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC'
));
if ($terms_alphabetical->have_posts()) :
$current_letter = '';
echo '<div class="alphabetical-list">';
while ($terms_alphabetical->have_posts()) : $terms_alphabetical->the_post();
$first_letter = strtoupper(mb_substr(get_the_title(), 0, 1));
if ($first_letter != $current_letter) {
if ($current_letter != '') {
echo '</div>';
}
$current_letter = $first_letter;
echo '<div class="letter-group">';
echo '<div class="letter-title">' . $current_letter . '</div>';
}
echo '<h2 class="term-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
endwhile;
echo '</div>';
echo '</div>';
else :
echo '<p>Nessun termine trovato.</p>';
endif;
wp_reset_postdata();
?>
</div>
<?php get_footer(); ?>