Skip to content

Commit

Permalink
fix(BaseStyle): use custom document title, instead of archive title
Browse files Browse the repository at this point in the history
  • Loading branch information
steffenbew committed Nov 28, 2019
1 parent ac173bb commit 5a0fd5b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions inc/baseStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,26 @@ function registerRewriteRule()
add_rewrite_tag("%{$routeName}%", "([^&]+)");
}

function setDocumentTitle()
{
// prevent yoast overwriting the title
add_filter('pre_get_document_title', function ($title) {
return '';
}, 99);

// set custom title and keep the default separator and site name
add_filter('document_title_parts', function ($title) {
$title['title'] = 'Base Style';
return $title;
}, 99);
}

function templateInclude($template)
{
global $wp_query;

if (isset($wp_query->query_vars[ROUTENAME])) {
setDocumentTitle();
add_action('wp_head', 'wp_no_robots');
return get_template_directory() . '/basestyle.php';
}
Expand Down

0 comments on commit 5a0fd5b

Please # to comment.