diff --git a/eth-escape-headspace.php b/eth-escape-headspace.php index b33c86a330e54ea2230bf853170a2e5691cb3b6a..c003d4722a0287d286ac10206f416ae66b0b8b6f 100644 --- a/eth-escape-headspace.php +++ b/eth-escape-headspace.php @@ -73,6 +73,8 @@ class ETH_Escape_HeadSpace2 { */ private function __construct() { add_filter( 'pre_get_document_title', array( $this, 'filter_pre_get_document_title' ) ); + add_filter( 'wp_title', array( $this, 'filter_wp_title' ), 10, 3 ); + add_action( 'wp_head', array( $this, 'action_wp_head' ) ); add_action( 'wp_footer', array( $this, 'action_wp_footer' ) ); } @@ -92,6 +94,27 @@ class ETH_Escape_HeadSpace2 { return $title; } + /** + * + */ + public function filter_wp_title( $title, $sep, $loc ) { + $_title = get_post_meta( get_the_ID(), '_headspace_page_title', true ); + + if ( ! empty( $_title ) ) { + $_title = esc_html( $_title ); + + if ( 'right' == $loc ) { + $title = $_title . ' ' . $sep . ' '; + } else { + $title = ' ' . $sep . ' ' . $_title; + } + } + + unset( $_title ); + + return $title; + } + /** * */