There seems to be a bug in a Wordpress PHP function that leaves whitespace in front of the title of the page generated by <?php echo wp_title(''); ?>
I've been through the Wordpress docs and forums on that function without any luck.
I'm using it this way <body id="<?php echo wp_title(''); ?>">
in order to generate an HTML body tag with the id of the page title.
So what I need to do is strip that white space, so that the body tag looks like this <body id="mypage">
instead of this <body id=" mypage">
The extra white space kills the CSS I'm trying to use to highlight menu items of the active page. When I manually add a correct body tag without the white space, my CSS works.
So how would I strip the white space? Thanks, Mark
Part Two of the Epic
John, A hex dump was a good idea; it shows the white space as two "20" spaces. But all solutions that strip leading spaces and white space didn't.
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 title leading characters - that look like chevrons - that are supposed to be dropped when the option is false, and they are, but white space gets dumped in.
Is there a nuclear option?
Yup, tried them both before; they still return two leading spaces... arrgg