A Free plugin for you :)

December 3, 2010 – 3:57 am

I’ve setup a database at the old scripttricks.com-domain and wrote a small plugin that, when activated, grabs and displays a famous quote on all of your posts.

Demo: check the bottom of the posts on this blog :)

Here’s the code:

<?php
/*
Plugin Name: myQuotesWP
Version: 0.5
Plugin URI: http://www.scripttricks.com
Description: Adds a famous quote to the end of all blog posts
Author: Bjorn
Author URI:
*/
function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
function fetch_quote($content) {
if(! is_feed() && ! is_page()) { // dont want it showing on anything but posts
$content .= file_get_contents_curl(“http://www.scripttricks.com/qu1/getquote.php”);
}
return $content;
}
add_filter(‘the_content’, ‘fetch_quote’);
?>
Save the code as “myQuotesWP.php”, copy it into your plugins-folder, activate and you’re ready to go. If you make any improvements on it or tweak, don’t hesitate to let me know, I enjoy seeing what others do with my code :)
You can also download it right here:
http://bjornsays.com/wp-content/plugins/downloads-manager/img/icons/winzip.gif download: myQuotesWP (532B)
added: 03/12/2010

description: Grabs a famous quote from scripttricks.com and adds it to the end of your posts. Unzip into your wp-content/plugins-folder, activate and you're set.
  1. 2 Responses to “A Free plugin for you :)”

  2. There was a slight hiccup with domain-renewal making scripttricks.com (the domain the quotes are fetched from) point somewhere else. It has been taken care of so the quotes should show correctly within 24 hours. Sorry :(

    By bjornspersson on Dec 5, 2010

  3. News update: Sometimes it's good to fetch data from an off-site service, and sometimes it's not. There's a new version on its way, that doesn't rely on off-site services. It will be announced in a separate post, so keep your eyes on the front page.

    By bjornspersson on Dec 11, 2010

Post a Comment