• If I publish a post with the following title:

    test - test's & test

    the default tweet that goes out replaces the hyphen, apostrophe, and ampersand with html entities: #8211, #039, and amp; (can’t display these properly in this forum)

    Now, obviously this doesn’t look very nice in twitter, because it outputs those directly as code. So the usual solution would be to disable wptexturize on the_title in functions.php:

    remove_filter('the_title','wptexturize');

    However, this doesn’t work. It fixes up the hyphen, but nothing else.

    I’ve done some debugging, and calling stc_get_default_tweet($id)somewhere else results in the correct title – just not on the edit page. This appears to be because earlier on, the post is being grabbed via get_post_to_edit, which calls get_post with a filter of edit, which then converts various things via sanitize functions. When it comes to stc_get_default_tweet, get_post returns the cached version which has been sanitized – so $post->post_title already contains those HTML entities before anything gets done at all.

    Is there any way around this? (Or is this even a bug in WordPress that it returns the same cached version regardless of the filter set?)

    http://wordpress.org/extend/plugins/simple-twitter-connect/

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’ve got also the same problem, and some of my tweets have html entities instead of apostrophes because of that…

    I had to do an dirty hack after line 192 of stc-publish.php to solve it

    $output = $options['publish_text'];
     $title = str_replace(' ',' ',get_the_title($id) );
     $output = str_replace('%title%', $title, $output );
     $output = str_replace('%url%', $link, $output );
     $output = str_replace('& #8217;',"'",$output);
     $output = str_replace('& #8220;','"',$output);
     $output = str_replace('& #8221;','"',$output);
    
     $output = apply_filters('stc_publish_text', $output, $id);
    
     $output = apply_filters('stc_publish_text', $output, $id);
    
     $output = apply_filters('stc_publish_text', $output, $id);

    (removing the space between & and # in the str_replaces) instead of

    $output = $options['publish_text'];
     $title = str_replace(' ',' ',get_the_title($id) );
     $output = str_replace('%title%', $title, $output );
     $output = str_replace('%url%', $link, $output );
    
     $output = apply_filters('stc_publish_text', $output, $id);

    Hope it helps…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Simple Twitter Connect] Preventing tweet showing html entities for apostrophes etc’ is closed to new replies.