Skip to content

Commit 83d81f3

Browse files
authored
fix(crumb): Fix blog items getting invalid URL (Fixes #3) (#13)
* enhance(crumb): Add the blog page `id` to the blog item * chore(docs): Bump minimum required version to 7.4
1 parent 82ce124 commit 83d81f3

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A simple breadcrumb package for Sage 10.
99
## Requirements
1010

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

1515
## Installation

src/Crumb.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ public function __construct(array $config)
3838
protected function add($key, $value = null, $id = null, $blog = false)
3939
{
4040
if (
41-
($value === true && empty($blog) || $blog === true) &&
41+
$blog === true &&
4242
get_option('show_on_front') === 'page' &&
4343
! empty($blog = get_option('page_for_posts')) &&
4444
! empty($this->config['blog'])
4545
) {
4646
$this->add(
4747
$this->config['blog'],
48-
get_permalink($blog)
48+
get_permalink($blog),
49+
$blog
4950
);
5051
}
5152

@@ -131,19 +132,25 @@ public function build()
131132
if (is_month()) {
132133
return $this->add(
133134
get_the_date('F Y'),
135+
null,
136+
null,
134137
true
135138
);
136139
}
137140

138141
if (is_year()) {
139142
return $this->add(
140143
get_the_date('Y'),
144+
null,
145+
null,
141146
true
142147
);
143148
}
144149

145150
return $this->add(
146151
get_the_date(),
152+
null,
153+
null,
147154
true
148155
);
149156
}

0 commit comments

Comments
 (0)