Saturday, July 24, 2010

Twitter Tip: Add a ‘Tweet This’ Link to your Blog on WordPress or Blogger

Twitter can be a great source of traffic for your blog.
To give you an example, my article on bookmarklets was on
the delicious popular section for more than a day yet Twitter
sent in more visitors than delicious thanks to all the tweets.

Now if you want to make it easy for your site visitors to share
links of your blog articles on Twitter, follow the instructions
below – you don’t need any plug-ins and the post URLs are automatically
shortened in the tweet via bit.ly (a good alternative to tinyurl
that also provides live traffic statistics).

Add Tweet This to your WordPress Theme

Step 1: Open the header.php file of WordPress and insert the following lines
just before the closing tag.



Step 2: Open the single.php file and insert the following line just below
the_content() function.


Reading: Tweet This: Send Page to Twitter
There’s a similar service called TwitThis which is again easy to setup but it
requires the Twitter password so some of your readers may not feel very
comfortable doing that.

Add Twitter to Blogger Template

Go to your Blog Layout -> Edit HTML and click the box that says
"Expand widget templates".

Take a backup of your Blogger template. Now search for the class "post-footer"
in the Blogger XML template and copy-paste the following snippet somewhere near
that class.


Wednesday, July 7, 2010

Display a different image for each day of the week

Description

This PHP script will get the day of the week from the server
date and then display an image (jpg or gif) to match.

The code


/**
 * Change the name of the image folder
 *
 * Images must be named Monday.gif, Tuesday.gif etc
 */

// Change to the location of the folder containing the
 images
$image_folder "images/days";
// You do not need to edit below this line
$today date('l');

if (file_exists($image_folder."/".$today.".gif")) {

echo ".$today.".gif\">";

}

else {
 
echo "No image was found for $today";

}
?>