| @@ -1,41 +1,44 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * The Template for displaying Filters found posts number. |
| 4 | 4 | * |
| 5 | - * This template can be overridden by copying it to yourtheme/filter/posts-found.php. | |
| 5 | + * This template can be overridden by copying it to yourtheme/filters/posts-found.php. | |
| 6 | 6 | * |
| 7 | 7 | * $posts_found - int|NULL, posts found number |
| 8 | 8 | * $singular_label - string label for single found post |
| 9 | 9 | * $plural_label - string label for multiple found posts |
| 10 | + * $hidden - makes an element hidden | |
| 10 | 11 | * |
| 11 | 12 | * @see https://filtereverything.pro/resources/templates-overriding/ |
| 12 | 13 | */ |
| 13 | 14 | |
| 14 | -if ( ! defined('WPINC') ) { | |
| 15 | - wp_die(); | |
| 15 | +if ( ! defined('ABSPATH') ) { | |
| 16 | + exit; | |
| 16 | 17 | } |
| 17 | 18 | |
| 18 | 19 | ?> |
| 19 | -<div class="wpc-posts-found" data-found="<?php echo esc_attr( $posts_found_count ); ?>"> | |
| 20 | -<p><?php | |
| 21 | - if( $posts_found_count !== NULL ) { | |
| 22 | - $class = ( $posts_found_count > 1 ) ? 'wpc-posts-found-number wpc-plural' : 'wpc-posts-found-number'; | |
| 23 | - $label = ( $posts_found_count > 1 ) ? $plural_label : $singular_label; | |
| 20 | +<div class="wpc-posts-found<?php echo ($hidden) ? " wpc-posts-found-hidden" : ''; ?>" data-found="<?php echo esc_attr( $posts_found_count ); ?>"> | |
| 21 | +<?php if( !$hidden ) : ?> | |
| 22 | + <p><?php | |
| 23 | + if( $posts_found_count !== NULL ) { | |
| 24 | + $class = ( $posts_found_count > 1 ) ? 'wpc-posts-found-number wpc-plural' : 'wpc-posts-found-number'; | |
| 25 | + $label = ( $posts_found_count > 1 ) ? $plural_label : $singular_label; | |
| 24 | 26 | |
| 25 | - echo wp_kses( | |
| 26 | - sprintf( _n( | |
| 27 | - '<span class="%s">%d</span> %s found', | |
| 28 | - '<span class="%s">%d</span> %s found', | |
| 29 | - $posts_found_count, | |
| 30 | - 'filter-everything' | |
| 31 | - ), $class, $posts_found_count, $label ), | |
| 32 | - array( | |
| 33 | - 'span' => array('class' => true) | |
| 34 | - ) | |
| 35 | - ); | |
| 27 | + echo wp_kses( | |
| 28 | + sprintf( _n( | |
| 29 | + '<span class="%s">%d</span> %s found', | |
| 30 | + '<span class="%s">%d</span> %s found', | |
| 31 | + $posts_found_count, | |
| 32 | + 'filter-everything' | |
| 33 | + ), $class, $posts_found_count, $label ), | |
| 34 | + array( | |
| 35 | + 'span' => array('class' => true) | |
| 36 | + ) | |
| 37 | + ); | |
| 36 | 38 | |
| 37 | - }else{ | |
| 38 | - echo ' '; | |
| 39 | - } | |
| 40 | -?></p> | |
| 39 | + }else{ | |
| 40 | + echo ' '; | |
| 41 | + } | |
| 42 | + ?></p> | |
| 43 | +<?php endif; ?> | |
| 41 | 44 | </div> |