<?php
/**
 *  Shuffle filter view file
 *
 * This template can be overridden by copying it to yourtheme/smart-post-show-pro/templates/filter.php
 *
 * @package    Smart_Post_Show_Pro
 * @subpackage Smart_Post_Show_Pro/public/template
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
?>
<div id="pcp_wrapper-<?php echo esc_attr( $smart_show_id ); ?>" class="<?php self::pcp_wrapper_classes( $layout_preset, $smart_show_id, $grid_style, $item_same_height_class ); ?> sps-glossary-layout"  <?php self::wrapper_data( $pagination_type, $pagination_type_mobile, $smart_show_id ); ?> data-lang="<?php echo esc_attr( $spsp_lang ); ?>" data-current_post_id="<?php the_ID(); ?>">
<?php
	SP_PCP_HTML::pcp_section_title( $section_title, $show_section_title );
	SP_PCP_HTML::pcp_preloader( $show_preloader );

	// A-Z Filter "All" button text.
	$all_text = isset( $view_options['pcp_rename_all_text'] ) ? $view_options['pcp_rename_all_text'] : 'All';
	
if ( ! $pcp_query->is_main_query() ) {
	$all_tab      = true;
	$all_tab_text = 'All';
	?>
		<div class="sps-az-filter">
				<ul class="sps-az-filter-button sps-glossary-filter">
				<?php if ( $all_tab ) : ?>
					<li><button class="active" data-letter="all"><?php echo esc_html( $all_text ); ?></button></li>
					<?php endif; ?>
				<?php
				// Generate the A-Z navigation links.
				$letters = apply_filters( 'sps_atoz_rang', range( 'A', 'Z' ) );
				foreach ( $letters as $letter ) {
					echo '<li><button data-letter="' . esc_attr( $letter ) . '">' . esc_html( $letter ) . '</button></li>';
				}
				?>
				<li><button data-letter="others">0-9</button></li>
				</ul>
			</div>
<?php } ?>
	<div class="sp-pcp-row">
		<?php
		self::pcp_get_posts( $options, $layout, $post_content_sorter, $pcp_query, $smart_show_id );
		?>
	</div>
</div>
