Skip to content

Commit

Permalink
Merge pull request #16 from joanrodas/dev
Browse files Browse the repository at this point in the history
Callable title
  • Loading branch information
joanrodas authored Jun 16, 2022
2 parents 2966e15 + b992172 commit ae09bd4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions PluboRoutes/RoutesProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ public function modifyTitle($title_parts)
{
if ($this->matched_route instanceof Route) {
$route_title = $this->matched_route->getTitle();
if (is_callable($route_title)) {
$title_parts['title'] = call_user_func($route_title, $this->matched_args);
return $title_parts;
}
$title_parts['title'] = $route_title ?? get_bloginfo( 'name' );
}
return $title_parts;
Expand Down

0 comments on commit ae09bd4

Please sign in to comment.