Automatically provide tinyurls for your WordPress posts
February 14, 2009
If you want to reduce the size of urls, you can use tinyurls, but how to provide a tinyurl to your wordpress blog posts? Simply open your functions.php file and paste the following code: function getTinyUrl($url) { $tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url); return $tinyurl; } On your single.php file, paste the following within the loop: <?php $turl = getTinyUrl(get_permalink($post->ID)); echo 'Tiny Url for this post: <a href="'.$turl.'">'.$turl.'</a>' ?> In your php.ini... [Read the full story]
Separate each wordpress post with an image
February 8, 2009
First, you need an image. Once you have it, upload it to your wp-content/themes/yourthemes/images directory, open up your index.php file, find the loop and make sure that each post is embedded throught a <div class=”post”> tag. This is the case on most themes. Then, edit your style.css file. Find the following line: .post { And paste this code: background: transparent url(images/yourimage.jpg) no-repeat bottom; Read More →
Style wordpress posts individually
February 4, 2009
To be able to style posts individually, you have to edit your single.php file and find the line starting with: <div class="post"> Simply change this line to: <div class="post" id="post-<?php the_ID(); ?>"> Once you saved the file, you can style an individual post by using the #post-XXX id: #post-xxx { background: #113355; color:#069; font-weight:bold; } Read More →
Randomize wordpress posts order
February 3, 2009
Are you building a portfolio or a gallery with WordPress? If yes, it can be a good thing to randomize posts order, that’s very easy to do with WordPress. To randomize posts order, you’ll have to use the very powerful query_posts() function before your WordPress loop: query_posts('orderby=rand'); //Your loop goes here Of course, it is also possible to randomize only a certain category: query_posts('cat=8&orderby=rand'); //Your loop goes here Read More →
Display your current mood on your wordpress posts
February 1, 2009
Open your single.php file (You can also modify your index.php file) and paste the following code anywhere within the loop: $customField = get_post_custom_values("mood"); if (isset($customField[0])) { echo “Mood: “.$customField[0]; Save the file. Now when you’ll write a new post, just create a custom field named mood and type your current mood as a value. Read More →




















