Skip to content
This repository was archived by the owner on Mar 17, 2022. It is now read-only.

Commit 9eaf0ca

Browse files
committed
Fix #257 , Fix #247
1 parent 01bc5b2 commit 9eaf0ca

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/Hyyan/WPI/Pages.php

+15-8
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,23 @@ public function translateShopUrl($url, $language) {
161161
* @return string modified form
162162
*/
163163
public function addShortcodeLanguageFilter($query_args, $atts) {
164-
165-
$ids = explode(',', $atts['ids']);
166-
$transIds = array();
167-
foreach ($ids as $id) {
168-
array_push($transIds, pll_get_post($id));
169-
}
170164

171-
$atts['ids'] = $transIds;
172-
$query_args['post__in'] = $transIds;
173165

166+
if (strlen($atts['ids'])) {
167+
168+
$ids = explode(',', $atts['ids']);
169+
$transIds = array();
170+
foreach ($ids as $id) {
171+
array_push($transIds, pll_get_post($id));
172+
}
173+
174+
$atts['ids'] = implode($transIds, ',');
175+
$query_args['post__in'] = $transIds;
176+
} else {
177+
$query_args['lang'] = isset($query_args['lang']) ?
178+
$query_args['lang'] : pll_current_language();
179+
}
180+
174181
return $query_args;
175182
}
176183

0 commit comments

Comments
 (0)