From 5e4c3c763d526661e078d2414447e4c5f5378996 Mon Sep 17 00:00:00 2001 From: prcdevgitbot Date: Mon, 21 Oct 2024 17:01:23 +0000 Subject: [PATCH] See https://github.com/pewresearch/prc-platform/commit/bae28ff1db35fc9f7c0ab4b86915d43a85bc1174 from refs/tags/v1.0.21 --- .../blocks/facet-template/facet-template.php | 19 +++++++++++-------- includes/schema-meta/class-schema-meta.php | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/includes/facets/blocks/facet-template/facet-template.php b/includes/facets/blocks/facet-template/facet-template.php index 153722f..4d357a8 100644 --- a/includes/facets/blocks/facet-template/facet-template.php +++ b/includes/facets/blocks/facet-template/facet-template.php @@ -94,16 +94,19 @@ public function render_block_callback($attributes, $content, $block) { $selected = (array) $facet['selected']; if (empty($facet_data)) { - return '

No facets data

'; return ''; } - // Sort data by count. - usort($facet_data, function($a, $b) { - if ($a['count'] === $b['count']) { - return 0; - } - return $a['count'] > $b['count'] ? -1 : 1; - }); + + // For now, lets restrict this sorting to only lists. + if ( $facet_type !== 'dropdown' ) { + usort($facet_data, function($a, $b) { + if ($a['count'] === $b['count']) { + return 0; + } + return $a['count'] > $b['count'] ? -1 : 1; + }); + } + $choices = $facet_data; // If the $choices exceeds the limit, we need to remove the excess choices and store them in a separate array, $expanded_choices. diff --git a/includes/schema-meta/class-schema-meta.php b/includes/schema-meta/class-schema-meta.php index f3789f9..f842d99 100644 --- a/includes/schema-meta/class-schema-meta.php +++ b/includes/schema-meta/class-schema-meta.php @@ -32,7 +32,7 @@ public function init($loader = null) { if ( null !== $loader ) { $loader->add_filter( 'wpseo_robots', $this, 'yoast_seo_no_index' ); $loader->add_action( 'wp_head', $this, 'force_search_engines_to_use_meta' ); - $loader->add_filter( 'wpseo_title', $this, 'yoast_seo_legacy_title_fix', 10, 1 ); + // $loader->add_filter( 'wpseo_title', $this, 'yoast_seo_legacy_title_fix', 10, 1 ); // I don't think we need this anymore. $loader->add_filter( 'wpseo_opengraph_title', $this, 'remove_pipe_from_social_titles', 10, 1 ); $loader->add_filter( 'wpseo_opengraph_image', $this, 'get_chart_image', 100, 1 ); $loader->add_filter( 'wpseo_metadesc', $this, 'get_chart_description', 100, 1 );