Skip to content

Commit

Permalink
fix(crumb): Fix blog items getting invalid URL (Fixes #3) (#13)
Browse files Browse the repository at this point in the history
* enhance(crumb): Add the blog page `id` to the blog item
* chore(docs): Bump minimum required version to 7.4
  • Loading branch information
Log1x authored Jul 29, 2023
1 parent 82ce124 commit 83d81f3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A simple breadcrumb package for Sage 10.
## Requirements

- [Sage](https://github.com/roots/sage) >= 10.0
- [PHP](https://secure.php.net/manual/en/install.php) >= 7.3
- [PHP](https://secure.php.net/manual/en/install.php) >= 7.4
- [Composer](https://getcomposer.org/download/)

## Installation
Expand Down
11 changes: 9 additions & 2 deletions src/Crumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ public function __construct(array $config)
protected function add($key, $value = null, $id = null, $blog = false)
{
if (
($value === true && empty($blog) || $blog === true) &&
$blog === true &&
get_option('show_on_front') === 'page' &&
! empty($blog = get_option('page_for_posts')) &&
! empty($this->config['blog'])
) {
$this->add(
$this->config['blog'],
get_permalink($blog)
get_permalink($blog),
$blog
);
}

Expand Down Expand Up @@ -131,19 +132,25 @@ public function build()
if (is_month()) {
return $this->add(
get_the_date('F Y'),
null,
null,
true
);
}

if (is_year()) {
return $this->add(
get_the_date('Y'),
null,
null,
true
);
}

return $this->add(
get_the_date(),
null,
null,
true
);
}
Expand Down

0 comments on commit 83d81f3

Please sign in to comment.