diff --git a/category.php b/category.php index 72be9df3..5dcd30e5 100644 --- a/category.php +++ b/category.php @@ -55,6 +55,7 @@ get_header(); 'tag_cloud', 'smallest' => 0.625, 'largest' => 1.25, 'unit' => 'rem', diff --git a/includes/functions/_setup-wordpress.php b/includes/functions/_setup-wordpress.php index 6184a26e..104117de 100644 --- a/includes/functions/_setup-wordpress.php +++ b/includes/functions/_setup-wordpress.php @@ -319,8 +319,14 @@ add_action( 'pre_get_posts', 'fictioneer_extend_taxonomy_pages' ); * @return array Array of found terms with modified counts. */ -function fictioneer_exclude_non_stories_from_cloud_counts( $terms, $taxonomies ) { - if ( ! is_tax() || is_admin() || empty( $terms ) || empty( $taxonomies ) ) { +function fictioneer_exclude_non_stories_from_cloud_counts( $terms, $taxonomies, $args ) { + if ( + ! ( is_tax() || is_tag() || is_category() ) || + is_admin() || + empty( $terms ) || + empty( $taxonomies ) || + ( $args['fictioneer_query_name'] ?? 0 ) !== 'tag_cloud' + ) { return $terms; } @@ -331,7 +337,12 @@ function fictioneer_exclude_non_stories_from_cloud_counts( $terms, $taxonomies ) if ( ! empty( $matched_taxonomies ) ) { foreach ( $terms as &$term ) { - $term_ids = get_term_children( $term->term_id, $term->taxonomy ); + $term_ids = []; + + if ( $args['pad_counts'] ?? 0 ) { + $term_ids = get_term_children( $term->term_id, $term->taxonomy ); + } + $term_ids[] = $term->term_id; $count = $wpdb->get_var( diff --git a/tag.php b/tag.php index f52229b5..546ab939 100644 --- a/tag.php +++ b/tag.php @@ -63,6 +63,7 @@ get_header(); 'tag_cloud', 'smallest' => .625, 'largest' => 1.25, 'unit' => 'rem', diff --git a/taxonomy-fcn_character.php b/taxonomy-fcn_character.php index 578c462c..7b5cab32 100644 --- a/taxonomy-fcn_character.php +++ b/taxonomy-fcn_character.php @@ -64,6 +64,7 @@ get_header(); 'tag_cloud', 'smallest' => .625, 'largest' => 1.25, 'unit' => 'rem', diff --git a/taxonomy-fcn_content_warning.php b/taxonomy-fcn_content_warning.php index c45448ed..28d3cf95 100644 --- a/taxonomy-fcn_content_warning.php +++ b/taxonomy-fcn_content_warning.php @@ -64,6 +64,7 @@ get_header(); 'tag_cloud', 'smallest' => .625, 'largest' => 1.25, 'unit' => 'rem', diff --git a/taxonomy-fcn_fandom.php b/taxonomy-fcn_fandom.php index 05d016d1..49587677 100644 --- a/taxonomy-fcn_fandom.php +++ b/taxonomy-fcn_fandom.php @@ -64,6 +64,7 @@ get_header(); 'tag_cloud', 'smallest' => .625, 'largest' => 1.25, 'unit' => 'rem', diff --git a/taxonomy-fcn_genre.php b/taxonomy-fcn_genre.php index e9a5a456..64d6bfbd 100644 --- a/taxonomy-fcn_genre.php +++ b/taxonomy-fcn_genre.php @@ -64,6 +64,7 @@ get_header(); 'tag_cloud', 'smallest' => .625, 'largest' => 1.25, 'unit' => 'rem',