Right, I’ve got a workaround which works for me and lets me keep wp-typography switched on. Posting here in case someone finds it useful…
Here’s what I’m now using:
<?php
$theTitle = get_the_title();
$theTitle = strip_tags($theTitle);
$theTitle = urlencode($theTitle);
$theTitle = str_replace("%C2%A0","+",$theTitle);
$theTitle = urldecode($theTitle);
$theTitle = str_replace(" ","",$theTitle);
$theTitle = str_replace("&","",$theTitle);
$thumbUrl = "/images/speakers/".$theTitle.".png";
?>
The result of which gets me the plain text of the title without spaces or ampersands. Phew!
The call to strip_tags() is in there specifically to get rid of the span class=”caps” which shows up on certain titles.
Two ways I can think of to do this better (but haven’t been able to actually do yet) would be:
1. Replacing the %C2%A0 character(s?) prior to urlencoding it.
2. Reading the un-“wp-typography” affected post title directly.
If anybody knows of an easier way, I’d love to here about it!