Skip to content

Commit 28f1213

Browse files
committed
Make URL accessible to Term class
1 parent 7251828 commit 28f1213

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Terms/Term.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Term
1313
public string $name = '';
1414
public string $slug = '';
1515
public string $description = '';
16+
public string $url = '';
1617
public self $parent;
1718

1819
public function __construct(int $id, string $taxonomy)
@@ -29,6 +30,7 @@ public function withAll()
2930
->withName()
3031
->withSlug()
3132
->withDescription()
33+
->withUrl()
3234
->withParent();
3335

3436
return $this;
@@ -55,6 +57,13 @@ public function withDescription()
5557
return $this;
5658
}
5759

60+
public function withUrl()
61+
{
62+
$this->url = \get_term_link($this->WP_Term);
63+
64+
return $this;
65+
}
66+
5867
public function withParent()
5968
{
6069
$this->parent = new self($this->WP_Term->parent, $this->taxonomy);

0 commit comments

Comments
 (0)