-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-erbe-medicinali.php
executable file
·51 lines (40 loc) · 1.52 KB
/
page-erbe-medicinali.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
43
44
45
46
47
48
49
50
51
<?php
/**
* Template Name: Erbe medicinali
*/
get_header(); ?>
<div id="content" class="container">
<h1 class="page-title">Piante medicinali</h1>
<?php
$terms_alphabetical = new WP_Query(array(
'post_type' => 'post',
'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>';
}
$nome_scientifico = get_post_meta(get_the_ID(), 'meta-box-nome-scientifico', true);
echo '<div class="name-scientific-name"><h2 class="post-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
echo '<h3 class="card-scientific-name">(' . $nome_scientifico . ')</h3></div>';
endwhile;
echo '</div>';
echo '</div>';
else :
echo '<p>Nessun termine trovato.</p>';
endif;
wp_reset_postdata();
?>
</div>
<?php get_footer(); ?>