From 3cb909a1cf399fca56d8d90c78aa8d484e75cd33 Mon Sep 17 00:00:00 2001
From: ren <18050944+renintw@users.noreply.github.com>
Date: Tue, 17 Oct 2023 04:10:01 +0900
Subject: [PATCH] Revert "Query Filters: Add taxonomy term counts (#228)"
This reverts commit ec0a70bc184314546a940c393cb6829c12f6e390.
---
.../wporg-showcase-2022/inc/block-config.php | 29 ++-----------------
1 file changed, 3 insertions(+), 26 deletions(-)
diff --git a/source/wp-content/themes/wporg-showcase-2022/inc/block-config.php b/source/wp-content/themes/wporg-showcase-2022/inc/block-config.php
index 7198b843..44d77f74 100644
--- a/source/wp-content/themes/wporg-showcase-2022/inc/block-config.php
+++ b/source/wp-content/themes/wporg-showcase-2022/inc/block-config.php
@@ -70,13 +70,12 @@ function ( $a, $b ) {
_n( 'Popular tags %s', 'Popular tags %s', $count, 'wporg' ),
$count
);
- $option_labels = get_option_labels( $tags );
return array(
'label' => $label,
'title' => __( 'Popular tags', 'wporg' ),
'key' => 'tag',
'action' => home_url( '/archives/' ),
- 'options' => array_combine( wp_list_pluck( $tags, 'slug' ), $option_labels ),
+ 'options' => array_combine( wp_list_pluck( $tags, 'slug' ), wp_list_pluck( $tags, 'name' ) ),
'selected' => $selected,
);
}
@@ -102,13 +101,12 @@ function get_flavor_options( $options ) {
_n( 'Flavors %s', 'Flavors %s', $count, 'wporg' ),
$count
);
- $option_labels = get_option_labels( $flavors );
return array(
'label' => $label,
'title' => __( 'Flavors', 'wporg' ),
'key' => 'flavor',
'action' => home_url( '/archives/' ),
- 'options' => array_combine( wp_list_pluck( $flavors, 'slug' ), $option_labels ),
+ 'options' => array_combine( wp_list_pluck( $flavors, 'slug' ), wp_list_pluck( $flavors, 'name' ) ),
'selected' => $selected,
);
}
@@ -149,14 +147,12 @@ function get_category_options( $options ) {
_n( 'Categories %s', 'Categories %s', $count, 'wporg' ),
$count
);
- $option_labels = get_option_labels( $categories );
-
return array(
'label' => $label,
'title' => __( 'Categories', 'wporg' ),
'key' => 'cat',
'action' => home_url( '/archives/' ),
- 'options' => array_combine( wp_list_pluck( $categories, 'term_id' ), $option_labels ),
+ 'options' => array_combine( wp_list_pluck( $categories, 'term_id' ), wp_list_pluck( $categories, 'name' ) ),
'selected' => $selected,
);
}
@@ -403,22 +399,3 @@ function update_site_breadcrumbs( $breadcrumbs ) {
return $breadcrumbs;
}
-
-/**
- * Get an array of option labels.
- * Each label is a string formatted as 'name (count)'. e.g, Business (30).
- *
- * @param array $taxonomy An arrays with taxonomy terms. e.g., Categories = [ Business, Store, etc. ].
- * @return array An array of formatted option label strings.
- */
-function get_option_labels( $taxonomy ) {
- $option_labels = array_map(
- function( $name, $count ) {
- return $name . " ($count)";
- },
- wp_list_pluck( $taxonomy, 'name' ),
- wp_list_pluck( $taxonomy, 'count' )
- );
-
- return $option_labels;
-}