| 1 |
<?php |
| 2 |
/** |
| 3 |
* Featured Categories block template |
| 4 |
* |
| 5 |
* @var $attributes - block attributes |
| 6 |
* @var $options - layout options |
| 7 |
* |
| 8 |
* @link https://codesupply.co |
| 9 |
* @since 1.0.0 |
| 10 |
* |
| 11 |
* @package PowerKit |
| 12 |
* @subpackage PowerKit/templates |
| 13 |
*/ |
| 14 |
|
| 15 |
$params = array( |
| 16 |
'layout' => $attributes['layout'], |
| 17 |
'filter_ids' => $attributes['filter_ids'], |
| 18 |
'orderby' => $attributes['orderby'], |
| 19 |
'order' => $attributes['order'], |
| 20 |
'maximum' => $attributes['maximum'], |
| 21 |
'number' => $attributes['number'], |
| 22 |
); |
| 23 |
|
| 24 |
echo '<div class="' . esc_attr( $attributes['className'] ) . '" ' . ( isset( $attributes['anchor'] ) ? ' id="' . esc_attr( $attributes['anchor'] ) . '"' : '' ) . '>'; |
| 25 |
|
| 26 |
// Convert filter ids. |
| 27 |
if ( $params['filter_ids'] ) { |
| 28 |
|
| 29 |
$params['filter_ids'] = wp_parse_list( $params['filter_ids'] ); |
| 30 |
|
| 31 |
foreach ( $params['filter_ids'] as $key => $slug ) { |
| 32 |
$term = get_term_by( 'slug', $slug, 'category' ); |
| 33 |
|
| 34 |
if ( isset( $term->term_id ) ) { |
| 35 |
$params['filter_ids'][ $key ] = $term->term_id; |
| 36 |
} |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
powerkit_featured_categories_output( $params ); |
| 41 |
|
| 42 |
echo '</div>'; |
| 43 |
|