| 1 |
<?php |
| 2 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- view template receives variables via extract(); prefixing is impractical. |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
$attributes = [ |
| 8 |
'href' => esc_url( $permalink ), |
| 9 |
'data-id' => isset( $term->term_id ) ? esc_attr( $term->term_id ) : 0, |
| 10 |
'class' => [ 'category-box category-' . esc_attr( $term->slug ) ] |
| 11 |
]; |
| 12 |
|
| 13 |
if ( ! isset( $column ) ) { |
| 14 |
$column = 4; |
| 15 |
} |
| 16 |
|
| 17 |
if ( $terms_number % $column == 0 ) { |
| 18 |
$wrapper_class[] = 'no-border-right'; |
| 19 |
} |
| 20 |
|
| 21 |
if ( $terms_count <= $reminder ) { |
| 22 |
$wrapper_class[] = 'no-border-bottom'; |
| 23 |
} |
| 24 |
|
| 25 |
if ( $reminder == 0 && $terms_count <= $column ) { |
| 26 |
$wrapper_class[] = 'no-border-bottom'; |
| 27 |
} |
| 28 |
|
| 29 |
if ( isset( $wrapper_class ) && is_array( $wrapper_class ) && ! empty( $wrapper_class ) ) { |
| 30 |
$attributes['class'] = array_merge( $attributes['class'], $wrapper_class ); |
| 31 |
} |
| 32 |
|
| 33 |
$attributes = betterdocs()->template_helper->get_html_attributes( $attributes ); |
| 34 |
?> |
| 35 |
|
| 36 |
<a |
| 37 |
<?php echo $attributes; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> |
| 38 |
<div class="betterdocs-single-category-inner"> |
| 39 |
<?php $view_object->get( 'layout-parts/header' ); ?> |
| 40 |
</div> |
| 41 |
</a> |
| 42 |
|