a-z-listing.example.php
68 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Example template for the AlphaListing plugin |
| 4 | * |
| 5 | * This template will be given the variable `$a_z_query` which is an instance of |
| 6 | * `eslin87\AlphaListing\Query`. |
| 7 | * |
| 8 | * You can override the default template by copying this file into your theme |
| 9 | * directory and renaming it to `a-z-listing.php`. |
| 10 | * |
| 11 | * @package alphalisting |
| 12 | */ |
| 13 | |
| 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | exit; // Exit if accessed directly. |
| 16 | } |
| 17 | |
| 18 | ?> |
| 19 | <div id="<?php $a_z_query->the_instance_id(); ?>" style="<?php $a_z_query->get_customized_column_styles(); ?>" class="az-listing"> |
| 20 | <div class="az-letters-wrap"> |
| 21 | <div class="az-letters"> |
| 22 | <?php $a_z_query->the_letters(); ?> |
| 23 | </div> |
| 24 | </div> |
| 25 | <?php if ( $a_z_query->have_letters() ) : ?> |
| 26 | <div class="items-outer"> |
| 27 | <div class="items-inner"> |
| 28 | <?php |
| 29 | while ( $a_z_query->have_letters() ) : |
| 30 | $a_z_query->the_letter(); |
| 31 | ?> |
| 32 | <?php if ( $a_z_query->have_items() ) : ?> |
| 33 | <div class="letter-section" id="<?php $a_z_query->the_letter_id(); ?>"> |
| 34 | <h2 class="letter-title"> |
| 35 | <span> |
| 36 | <?php $a_z_query->the_letter_title(); ?> |
| 37 | </span> |
| 38 | </h2> |
| 39 | |
| 40 | <ul> |
| 41 | <?php |
| 42 | while ( $a_z_query->have_items() ) : |
| 43 | $a_z_query->the_item(); |
| 44 | ?> |
| 45 | <li> |
| 46 | <a href="<?php $a_z_query->the_permalink(); ?>"><?php $a_z_query->the_title(); ?></a> |
| 47 | </li> |
| 48 | <?php endwhile; ?> |
| 49 | </ul> |
| 50 | |
| 51 | <?php if ( apply_filters( 'alphalisting_show_back_to_top', true, $a_z_query ) ) : ?> |
| 52 | <div class="back-to-top"> |
| 53 | <a href="#<?php $a_z_query->the_instance_id(); ?>"> |
| 54 | <?php esc_html_e( 'Back to top', 'alphalisting' ); ?> |
| 55 | </a> |
| 56 | </div> |
| 57 | <?php endif; ?> |
| 58 | </div> |
| 59 | <?php endif; ?> |
| 60 | <?php endwhile; ?> |
| 61 | </div> |
| 62 | </div> |
| 63 | </div> |
| 64 | <?php else : ?> |
| 65 | <p><?php esc_html_e( 'There are no posts included in this index.', 'alphalisting' ); ?></p> |
| 66 | <?php |
| 67 | endif; |
| 68 |