There seems to be an error in the Wordpress PHP function that leaves a space in front of the page title generated <?php echo wp_title(''); ?>. I went through Wordpress docs and forums on this feature with no luck.
I use it in such a way <body id="<?php echo wp_title(''); ?>">as to generate an HTML body tag with a page header id.
So what I need to do is a strip of white space, so the body tag looks like <body id="mypage">instead<body id=" mypage">
The extra white space kills the CSS I'm trying to use to highlight menu items on the active page. When I manually add the correct body tag without a space, my CSS works.
So how would I separate the space? Thanks Mark
Part Two of the Epic
John, a hexagonal dump was a good idea; it shows the space as two "20" spaces. But all the decisions shared by leading spaces and spaces have not been made.
AND, <?php ob_start(); $title = wp_title(''); ob_end_clean(); echo $title; ?>
gives me < body id ="">
and <?php ob_start(); $title = wp_title(''); echo $title; ?>
gives me < body id =" mypage">
Puzzle The root of the problem is that wp_title has optional page header headers that look like chevrons that should be dropped when the parameter is false, and they are there, but the empty space is reset.
Is there a nuclear option?
Yup, tried both of them before; they still return the two leading spaces ... arrgg
source
share