Skip to content

Commit

Permalink
enhance(pagi): Add support for custom taxonomies (Fixes #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x authored Feb 21, 2021
1 parent 36710eb commit 0b587aa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Pagi.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ protected function prepare()
return;
}

$this->query->put('post_type', get_post_type());

if (is_tax()) {
$this->query->put('tax_query', [[
'taxonomy' => $this->query->get('taxonomy'),
'terms' => $this->query->get('term'),
'field' => 'name',
]]);
}

$this->perPage = $this->query->get('posts_per_page');
$this->currentPage = max(1, absint(get_query_var('paged')));

Expand Down

0 comments on commit 0b587aa

Please sign in to comment.