Browse Source

fix wp_head depreciate 4.4.

windhamdavid 9 years ago
parent
commit
168a260daa
5 changed files with 33 additions and 13 deletions
  1. 1 0
      functions.php
  2. 0 1
      header-home.php
  3. 0 1
      header-studio.php
  4. 0 1
      header.php
  5. 32 10
      inc/template.php

+ 1 - 0
functions.php

@@ -6,6 +6,7 @@ function dw_setup() {
 	require( get_template_directory() . '/inc/template.php' );
 	require( get_template_directory() . '/inc/tweaks.php' );
 	if ( ! isset( $content_width ) ) $content_width = 1310;
+	add_theme_support( 'title-tag' );
 	add_theme_support( 'automatic-feed-links' );
 	add_theme_support( 'menus' );
 	add_theme_support( 'post-thumbnails' );

+ 0 - 1
header-home.php

@@ -10,7 +10,6 @@
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
 <meta name="description" content="David A. Windham - Zeken Woozer Enterprises, Un-Ltd. South Carolina USA" />
-<title><?php dw_page_title();?></title>
 <?php wp_head(); ?>
 </head>
 <body>

+ 0 - 1
header-studio.php

@@ -10,7 +10,6 @@
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
 <meta name="description" content="Studio | David A. Windham" />
-<title><?php dw_page_title();?></title>
 <?php wp_head(); ?>
 </head>
 <body>

+ 0 - 1
header.php

@@ -9,7 +9,6 @@
 <meta charset="UTF-8" />
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-<title><?php dw_page_title();?></title>
 <meta name="description" content="<?php dw_meta_desc();?>"/>
 <?php wp_head(); ?>
 </head>

+ 32 - 10
inc/template.php

@@ -26,17 +26,39 @@ function page_bodyclass() {
 }
 endif;
 
-if ( ! function_exists( 'dw_page_title') ) :
-function dw_page_title() {
-	global $page, $paged; 
-	wp_title( '|', true, 'right' ); 
-	bloginfo( 'name' ); $site_description = get_bloginfo( 'description', 'display' );
-	if ( $site_description && ( is_home() || is_front_page() ) )
-		echo " | $site_description";
-	if ( $paged >= 2 || $page >= 2 )
-		echo ' | ' . sprintf( __( 'Page %s', 'dw' ), max( $paged, $page ) );
+// ********* DEPRECIATED wp_title in 4.4 ***********
+//if ( ! function_exists( 'dw_page_title') ) :
+//function dw_page_title() {
+//	global $page, $paged; 
+//	wp_title( '|', true, 'right' ); 
+//	bloginfo( 'name' ); $site_description = get_bloginfo( 'description', 'display' );
+//	if ( $site_description && ( is_home() || is_front_page() ) )
+//		echo " | $site_description";
+//	if ( $paged >= 2 || $page >= 2 )
+//		echo ' | ' . sprintf( __( 'Page %s', 'dw' ), max( $paged, $page ) );
+//}
+//endif;
+
+function filter_wp_title( $title, $sep ) {
+    global $paged, $page;
+ 
+    if ( is_feed() )
+        return $title;
+ 
+    $title .= get_bloginfo( 'name' );
+ 
+    $site_description = get_bloginfo( 'description', 'display' );
+    if ( $site_description && ( is_home() || is_front_page() ) )
+        $title = "$title $sep $site_description";
+
+    if ( $paged >= 2 || $page >= 2 )
+        $title = "$title $sep " . sprintf( __( 'Page %s', 'twentytwelve' ), max( $paged, $page ) );
+ 
+    return $title;
 }
-endif;
+add_filter( 'wp_title', 'filter_wp_title', 10, 2 );
+add_filter( 'document_title_separator', function () { return '|'; } );
+
 
 if ( ! function_exists( 'dw_meta_desc') ) :
 function dw_meta_desc() {