All About Blog Design, Short Reviews, Tips and Make Money Online |
10 WordPress Hacks to Make your Life Easy Posted: 27 Aug 2008 06:29 PM CDT Displaying Gravatars in commentsTo refresh your memory, Gravatars are little user images from Gravatar.com that are displayed against your comments in the theme (if the theme is built to support Gravatars). A lot of WordPress themes are built without the support of Gravatars. So, here is some help for you to add Gravatars in your theme. Open up your comments.php file from the theme folder. Find this piece of code :-
Replace the above code with the following code :-
The above code will display the Gravatars. Now let us add some CSS to the style.css file for your theme.
When you check your theme again, you will see the Gravatar images against your comments. Image Gallery in WordPressAll the versions of WordPress 2.5+ have inbuilt Image Gallery function where you can upload your images in a set and then insert the gallery either into your post or a new page. But almost all the old themes(before 2.5) and many new ones do not have the integrated functionality. In order to add this feature, here is what you have to do :- In your existing theme, open single.php and save it as image.php in your theme folder. Now open this image.php file in an editor and find the line that displays the post content. It should be somewhat in the following form. It can differ a bit but the function is called by the_content like this :-
Now insert the following code above the aforementioned code (the_content) :-
Insert the following code below the aforementioned code (the_content) :-
Now, add this CSS to your theme’s style.css file :-
The above CSS code fixes the default gallery of WordPress which doesn’t look so good. So, now when you go and upload your images in a post or a page, go to the gallery option (after you have finished uploading all your images) and insert gallery into your post/page. That’s it! Adding a “Subscribe to feed” message after every postMany people use this kind of message to remind the readers to subscribe to their blogs and place them at the end of every post. This can be accomplished by using a simple plugin or you can do the following. If you want the message to show under all your posts on the homepage, open up index.php and just where your content finishes (the_content), add this line :-
You can do the same for your single.php file in the theme folder which is used to display your individual posts. Displaying Twitter messages on your blogIf you have a Twitter.com account and want to display the twitters that you make on your blog, here is what you have to do. Login to your Twitter.com account. Go to this URL :- http://twitter.com/badges/html and choose your settings. Copy the code and paste it on your blog. You can paste it directly into your theme files or use text widgets to put them in a sidebar. They can also be styled through CSS. Displaying Authors’ BioIn a multi-user blog, it can be beneficial to show the Authors’ Bio under every single post for the users to read about the post author. This can be done using the Biographical Info in the Your profile setting under Users section of WP-Admin. To integrate this bio, open up your single.php file and under the_content line (as before), add this code :-
Now, add the following CSS code to your style.css in the theme folder:-
Now if you refresh your individual post pages, you will see the author’s info under the post content. Categories drop downTo add a good looking drop down that will list all your existing categories, insert the following code in your blog template. You can do it either in your sidebar.php file or anywhere in the index.php. This is the code :-
Archives drop downJust like in categories, you can have your monthly archives listed in a drop down. Add the following code to your template files :-
Adding 125×125 Ads to your sidebarMany people do not know how to integrate 125×125 banner ads into their theme sidebars. I will explain it to you. Save the following image to your desktop (this is a sample 125×125 banner that we will use) :- Make a folder called “ads” in your theme folder (the theme in which you want to add these banners) and place this image (125.gif) in that new folder. Now, add the following code to your sidebar where you want the banners to appear :-
Finally, add the following CSS code to your style.css file :-
When you refresh your theme, you will see two adjacent 125×125 banner ads in your sidebar. You can then change the images as you like and also the hyperlinks. Displaying most commented (popular) postsThere is always an urge in bloggers to showcase their most popular posts or the posts with the most comments. This is how you can do it:- Place the following code at the end of your header.php file in the theme folder. You can change the number of popular post titles that will be pulled from the database by altering the $no_posts variable in the code :-
Now, wherever you want to display the popular posts list, place the following code. You can do it in the sidebar or the index.php file.
Adding a Print Button to your postsIn order to enable your users to take printouts of your posts, you can provide them with a Print button on the blog. Open up your single.php file (for individual posts) from the theme folder and add the following code wherever you want to have the Print option:-
I hope that you liked these WordPress hacks and also hope that they make your life easy in some way |
You are subscribed to email updates from Blog Oh Blog To stop receiving these emails, you may unsubscribe now. | Email Delivery powered by FeedBurner |
Inbox too full? Subscribe to the feed version of Blog Oh Blog in a feed reader. | |
If you prefer to unsubscribe via postal mail, write to: Blog Oh Blog, c/o FeedBurner, 20 W Kinzie, 9th Floor, Chicago IL USA 60610 |
No comments:
Post a Comment
Keep a civil tongue.