Add wp_title() filter
This commit is contained in:
@@ -80,6 +80,20 @@ function roots_language_attributes() {
|
|||||||
}
|
}
|
||||||
add_filter('language_attributes', 'roots_language_attributes');
|
add_filter('language_attributes', 'roots_language_attributes');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage output of wp_title()
|
||||||
|
*/
|
||||||
|
function roots_wp_title($title) {
|
||||||
|
if (is_feed()) {
|
||||||
|
return $title;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title .= get_bloginfo('name');
|
||||||
|
|
||||||
|
return $title;
|
||||||
|
}
|
||||||
|
add_filter('wp_title', 'roots_wp_title', 10);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up output of stylesheet <link> tags
|
* Clean up output of stylesheet <link> tags
|
||||||
*/
|
*/
|
||||||
@@ -128,7 +142,7 @@ function roots_root_relative_url($input) {
|
|||||||
if(!is_admin() && site_url() != home_url() && stristr($input, 'wp-includes') === false) {
|
if(!is_admin() && site_url() != home_url() && stristr($input, 'wp-includes') === false) {
|
||||||
$input = str_replace(site_url(), "", $input);
|
$input = str_replace(site_url(), "", $input);
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = preg_replace_callback(
|
$output = preg_replace_callback(
|
||||||
'!(https?://[^/|"]+)([^"]+)?!',
|
'!(https?://[^/|"]+)([^"]+)?!',
|
||||||
create_function(
|
create_function(
|
||||||
@@ -142,7 +156,7 @@ function roots_root_relative_url($input) {
|
|||||||
),
|
),
|
||||||
$input
|
$input
|
||||||
);
|
);
|
||||||
|
|
||||||
// detect and correct for subdir installs
|
// detect and correct for subdir installs
|
||||||
if($subdir = parse_url(home_url(), PHP_URL_PATH)) {
|
if($subdir = parse_url(home_url(), PHP_URL_PATH)) {
|
||||||
if(substr($output, 0, strlen($subdir)) == (substr($output, strlen($subdir), strlen($subdir)))) {
|
if(substr($output, 0, strlen($subdir)) == (substr($output, strlen($subdir), strlen($subdir)))) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]-->
|
<!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]-->
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title><?php wp_title(''); ?></title>
|
<title><?php wp_title('|', true, 'right'); ?></title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<?php wp_head(); ?>
|
<?php wp_head(); ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user