Encoding of apostrophes via the_title / get_the_title
-
I’ve been trying to create a custom Twitter button for a news website, but am having difficulties retrieving post titles. Perhaps the easiest way to describe the issue is just to show it: if you go to this page and try to use the Tweet button, you’ll see that the title outputs as “Ratings: Cadel Evans%E2%80%99 Tour de France victory sends SBS soaring” instead of using the apostrophe.
At the moment I’m using
str_replace
to turn “%20” into “+” signs which ensures that spaces turn out correctly:function the_titlestring() { $titlestring = get_the_title($post->ID); $titlestringprocessed = str_replace( " ", "+", $titlestring ); echo $titlestringprocessed; }
… but I can’t work out how to do the same thing with apostrophes and quotation marks. Is there a simple way to convert output from
get_the_title()
into the proper form?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Encoding of apostrophes via the_title / get_the_title’ is closed to new replies.