HT.com, now on WordBook

The Facebook API allows great interactions with others website, such as this blog!

The Facebook API allows great interactions with other websites, such as this blog!

Great plugin from Tsaiberspace, wich allow to automaticaly write on your facebook wall the content of your blog.

Only problem i found with it was related to image caption. Wordpress use brackets to manage it, so the content of the brackets would appear in the excerpt, something we don’t want. I modified the code to add a function to delete content in brackets. Problem with that is that if you want something in brackets to appear on your wall, it won’t. But i don’t think it’s really a problem.

I added a line to the function that gets the post content and make a excerpt out of it. Not the cleanest way possible, but it does the job.

function wordbook_post_excerpt($content, $maxlength) {
    $excerpt = strip_tags(apply_filters('the_excerpt', $content));
    $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
    if (strlen($excerpt) > $maxlength) {
        $excerpt = substr($excerpt, 0, $maxlength - 3) . '...';
    }
    return $excerpt;
}

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>