Skip to content

Commit a6811b7

Browse files
committed
fix(pagination): add missing parameters
1 parent 2a685cf commit a6811b7

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

includes/src/WP_Basic_Bootstrap_Pagination.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,27 @@ class WP_Basic_Bootstrap_Pagination
99
public $type = 'simple';
1010
protected $entries;
1111

12-
public function render()
12+
public function render($in_category = false)
1313
{
14+
$add_args = [];
1415
$this->entries = array();
1516

17+
$cats = get_the_category();
18+
if (count($cats)>0) {
19+
$add_args['category__and'] = $cats[0]->term_id;
20+
}
21+
1622
if (is_attachment()) {
1723
} elseif (is_single()) {
1824
$this->entries = array(
19-
'previous' => get_previous_post(),
20-
'next' => get_next_post(),
25+
'previous' => get_previous_post($add_args),
26+
'next' => get_next_post($add_args),
2127
);
2228

2329
// } elseif (is_archive() || is_search()) {
2430
} else {
2531
$this->type = 'numerical';
26-
$this->get_pagenav_num();
32+
$this->get_pagenav_num($add_args);
2733
}
2834

2935
return $this->entries;

includes/src/WP_Basic_Bootstrap_Setup.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,10 @@ public static function registerScriptsFrontend()
202202
$uri = $item['uri-cdn'];
203203
} elseif (strtolower(BASICBOOTSTRAP_ASSETS_LOADER) == 'npm' && isset($item['uri-npm'])) {
204204
$uri = $item['uri-npm'];
205-
} else {
205+
} elseif (isset($item['uri'])) {
206206
$uri = $item['uri'];
207+
} else {
208+
$uri = '';
207209
}
208210

209211
if (isset($item['replace_original']) && $item['replace_original'] == true) {

includes/template-library.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,13 @@ function get_the_breadcrumb()
271271
/**
272272
* Build pages pagination
273273
*/
274-
function get_the_pagination()
274+
function get_the_pagination($post_type = '')
275275
{
276276
basicbootstrap_load_class('WP_Basic_Bootstrap_Pagination');
277277
$paginator = new WP_Basic_Bootstrap_Pagination();
278278
$entries = $paginator->render();
279279
if (count($entries)) {
280-
get_template_part_hierarchical_fetch('partials/pagination/'.$paginator->type, '', $entries);
280+
get_template_part_hierarchical_fetch('partials/pagination/'.$paginator->type, $post_type, $entries);
281281
}
282282
}
283283

0 commit comments

Comments
 (0)