diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d768bf..cb69729 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v3.7.3 + +- Feat: getShowOnPortalURL(): add filter and sorting for portalUrls by numeric blogId with taxonomy 'openpub-show-on' + ## v3.7.2 - Refactor: register rest routes in correct order diff --git a/openpub-base.php b/openpub-base.php index 2a52c36..5e8db40 100644 --- a/openpub-base.php +++ b/openpub-base.php @@ -4,7 +4,7 @@ * Plugin Name: Yard | OpenPub Base * Plugin URI: https://www.openwebconcept.nl/ * Description: Acts as foundation for other OpenPub related content plugins. This plugin implements actions to allow for other plugins to add and/or change Custom Posttypes, Metaboxes, Taxonomies, en Posts 2 posts relations. - * Version: 3.7.2 + * Version: 3.7.3 * Author: Yard | Digital Agency * Author URI: https://www.yard.nl/ * License: GPL-3.0 diff --git a/src/Base/Foundation/Plugin.php b/src/Base/Foundation/Plugin.php index 3cb9d60..6fd5dd1 100644 --- a/src/Base/Foundation/Plugin.php +++ b/src/Base/Foundation/Plugin.php @@ -8,7 +8,7 @@ class Plugin { public const NAME = 'openpub-base'; - public const VERSION = '3.7.2'; + public const VERSION = '3.7.3'; protected string $rootPath; public Config $config; diff --git a/src/Base/Models/PortalLinkGenerator.php b/src/Base/Models/PortalLinkGenerator.php index cfba7d9..726595e 100644 --- a/src/Base/Models/PortalLinkGenerator.php +++ b/src/Base/Models/PortalLinkGenerator.php @@ -65,6 +65,16 @@ private function getShowOnPortalURL(): string return ''; } + // Filter out terms where slug is not numeric + $terms = array_filter($terms, function($term) { + return is_numeric($term->slug); + }); + + // Sort terms by slug (blog ID) + usort($terms, function($a, $b) { + return intval($a->slug) <=> intval($b->slug); + }); + $portalURL = reset($terms); if (isset($_GET['source'])) {