PluginProbe ʕ •ᴥ•ʔ
AlphaListing / 4.5.0
AlphaListing v4.5.0
4.5.0 trunk 4.3.4 4.3.5 4.3.6 4.3.7 4.4.0
alphalisting / templates / a-z-listing.php
alphalisting / templates Last commit date
a-z-listing.example.php 2 weeks ago a-z-listing.php 2 weeks ago
a-z-listing.php
93 lines
1 <?php
2 /**
3 * Default multi-column template for the AlphaListing plugin
4 *
5 * This template will be given the variable `$a_z_query` which is an instance
6 * of `AlphaListing`.
7 *
8 * You can override this template by copying this file into your theme
9 * directory.
10 *
11 * @package alphalisting
12 */
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit; // Exit if accessed directly.
16 }
17
18 /**
19 * This value indicates the number of posts to require before a second column
20 * is created. However, due to the design of web browsers, the posts will flow
21 * evenly between the available columns. E.g. if you have 11 items, a value of
22 * 10 here will create two columns with 6 items in the first column and 5 items
23 * in the second column.
24 */
25 $a_z_listing_minpercol = 10;
26 ?>
27
28 <div id="<?php $a_z_query->the_instance_id(); ?>" style="<?php $a_z_query->get_customized_column_styles(); ?>" class="az-listing">
29 <div class="az-letters-wrap">
30 <div class="az-letters">
31 <?php $a_z_query->the_letters(); ?>
32 </div>
33 </div>
34 <?php if ( $a_z_query->have_letters() ) : ?>
35 <div class="items-outer">
36 <div class="items-inner">
37 <?php
38 while ( $a_z_query->have_letters() ) :
39 $a_z_query->the_letter();
40 ?>
41 <?php if ( $a_z_query->have_items() ) : ?>
42 <?php
43 $a_z_listing_item_count = $a_z_query->get_the_letter_items_count();
44 $a_z_listing_num_columns = max(
45 1,
46 min(
47 16,
48 ceil( $a_z_listing_item_count / $a_z_listing_minpercol )
49 )
50 );
51 ?>
52 <div class="letter-section" id="<?php $a_z_query->the_letter_id(); ?>">
53 <h2 class="letter-title">
54 <span>
55 <?php $a_z_query->the_letter_title(); ?>
56 </span>
57 </h2>
58 <?php $a_z_listing_column_class = "max-$a_z_listing_num_columns-columns"; ?>
59 <ul class="az-columns <?php echo esc_attr( $a_z_listing_column_class ); ?>">
60 <?php
61 while ( $a_z_query->have_items() ) :
62 $a_z_query->the_item();
63 ?>
64 <li>
65 <a href="<?php $a_z_query->the_permalink(); ?>">
66 <?php $a_z_query->the_title(); ?>
67 </a>
68 </li>
69 <?php endwhile; ?>
70 </ul>
71
72 <?php if ( apply_filters( 'alphalisting_show_back_to_top', true, $a_z_query ) ) : ?>
73 <div class="back-to-top">
74 <a href="#<?php $a_z_query->the_instance_id(); ?>">
75 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-up" viewBox="0 0 16 16">
76 <path fill-rule="evenodd" d="M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708z"/>
77 </svg>
78 <?php esc_html_e( 'Back to top', 'alphalisting' ); ?>
79 </a>
80 </div>
81 <?php endif; ?>
82 </div>
83 <?php
84 endif;
85 endwhile;
86 ?>
87 </div>
88 </div>
89 <?php else : ?>
90 <p><?php esc_html_e( 'There are no posts included in this index.', 'alphalisting' ); ?></p>
91 <?php endif; ?>
92 </div>
93