I am building a WordPress theme in which I have a twitter share link beside each post
<a class="tw-share-link" href="http://twitter.com/home?status=Currently reading <?php the_article_title() ?>" Target="_blank">Tweet</a>
If the article title includes smart quotes, the quotes are replaced by ‘?’s in IE8 and below.
I tried converting the smart quotes to regular quotation marks hooking a function that uses
string replace to the action of saving or updating a post. This didn’t fix the issue.
?php
function convert_smart_quotes($string) {
//converts smart quotes to normal quotes.
$search = array(chr(145), chr(146), chr(147), chr(148), chr(151));
$replace = array("'", "'", '"', '"', '-');
return str_replace($search, $replace, $string);
}
?>
I need guidance troubleshooting this issue:
+ Do I need to add some sort of character set declaration to my code so that IE8 and below can handle smart-quotes?
+ Or is there a way in php to encode the twitter link so that smart quotes will be replaced by regular quotes? Thanks in advance.
Update:
I found a fix. Removing the wptexturize filter fixes the issue:
http://www.malcolmcoles.co.uk/blog/wordpress-smart-quotes/