From 281b7b2075be49c6a85050a6b7a29beef86805d1 Mon Sep 17 00:00:00 2001 From: NiclasNorin Date: Tue, 23 Sep 2025 15:38:33 +0200 Subject: [PATCH] fix: corrected pagination for posts --- source/php/Module/Posts/Posts.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/php/Module/Posts/Posts.php b/source/php/Module/Posts/Posts.php index 5eac375d9..c3f6c3b28 100644 --- a/source/php/Module/Posts/Posts.php +++ b/source/php/Module/Posts/Posts.php @@ -137,6 +137,7 @@ public function data(): array { $data = []; $this->fields = $this->getFields(); + $this->domainChecker = new DomainChecker($this->fields); $data['posts_display_as'] = $this->fields['posts_display_as'] ?? false; $data['display_reading_time'] = !empty($this->fields['posts_fields']) && in_array('reading_time', $this->fields['posts_fields']) ?? false; @@ -211,8 +212,8 @@ public function data(): array 'next' => __('Next slide', 'modularity'), ]; - if ($this->ID) { - $data['sliderId'] = $this->ID; + if ($this->getID()) { + $data['sliderId'] = $this->getID(); } else { $data['sliderId'] = uniqid(); $data['ID'] = uniqid(); @@ -241,7 +242,7 @@ public function data(): array * @return string */ private function getPaginationQueryVarName():string { - return "{$this->post_type}-{$this->ID}-page"; + return "{$this->slug}-{$this->getID()}-page"; } /** @@ -262,7 +263,7 @@ private function getPageNumber():int { */ private function getPaginationArguments(int $maxNumPages, int $currentPage):array { - if($maxNumPages < 2) { + if ($maxNumPages < 2) { return []; } @@ -280,7 +281,8 @@ private function getPaginationArguments(int $maxNumPages, int $currentPage):arra return [ 'list' => array_merge([$listItemOne], $listItems), - 'current' => $currentPage + 'current' => $currentPage, + 'linkPrefix' => $this->getPaginationQueryVarName() ]; }