for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Loads the `basestyle.php` template on route /BaseStyle/ to render base style markup for proper base styling.
*/
namespace Flynt\BaseStyle;
add_filter('init', 'Flynt\BaseStyle\registerRewriteRule');
add_filter('template_include', 'Flynt\BaseStyle\templateInclude');
const ROUTENAME = 'BaseStyle';
function registerRewriteRule()
{
$routeName = ROUTENAME;
add_rewrite_rule("{$routeName}/?$", "index.php?{$routeName}", "top");
add_rewrite_tag("%{$routeName}%", "([^&]+)");
}
function setDocumentTitle()
// prevent yoast overwriting the title
add_filter('pre_get_document_title', function ($title) {
$title
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
add_filter('pre_get_document_title', function (/** @scrutinizer ignore-unused */ $title) {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
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;
function templateInclude($template)
global $wp_query;
if (isset($wp_query->query_vars[ROUTENAME])) {
setDocumentTitle();
add_filter('wp_robots', 'wp_robots_no_robots');
return get_template_directory() . '/basestyle.php';
return $template;
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.