The last post that I had made on 10 WordPress Hacks to Make your Life Easy got a good number of comments and views. Based on the success, I have decided to make another WordPress Hacks post to make your life EVEN easier. Here is the list of 10 new hacks ready to be bookmarked :-
How to make a Sticky Post
A sticky post is one that will always be on top of all your recent posts and stay there until you change it. You can use a sticky post as a notification, reminder or something that you want to emphasize to your readers. Here is how you can make a sticky post :-
First, decide on a category name that will hold all your sticky posts. For example, you can create a new category and name it “Stickies” and later use this name to call the posts from this category. Now, if you have ever opened the index.php file in any blog styled WordPress theme (Just install the basic Whiteboard theme for this tutorial), you will notice that it has a loop which is used to call your posts.
The loop begins here :-
and this loop should end here :-
Sorry, nothing matches that criteria.
Copy everything from the start to the end of this loop (including the above code). Paste it above the existing loop so that index.php will have two identical loops, one over the another. To make the sticky post appear, we will use this new loop which will call a single post from the “Stickies” category.
In the top loop, just replace this code :-
with this :-
have_posts()) : $my_query1->the_post(); ?>
So, if you decide to change the category name from “Stickies” to something else, just change it in the above code. You can also change the number of posts that you want to show from the sticky category by modifying the showposts variable.
Breaking Categories into Columns
Normally when the list of categories is displayed in the sidebar or on any part of the theme, it displays in a single column. Through the following hack, you can split your categories’ list evenly into two or more columns which can save space and not make your pages longer. Usually in WordPress, the following code is used to call the categories’ list (you can find it in one of the sidebar files) :-
Now, we will try and split the categories into two columns. Replace the above code with the following :-
'; ';
",wp_list_categories('title_li=&echo=0&depth=1&style=none'));
$cat_n = count($cats) - 1;
for ($i=0;$i<$cat_n;$i++):
if ($i<$cat_n/2):
$cat_left = $cat_left.'
elseif ($i>=$cat_n/2):
$cat_right = $cat_right.'
endif;
endfor;
?>
Basically the above code will split your categories and put them into two lists (left and right). Now all you have to do is style them so that they float left of each other. Add this code to your style.css file :-
.right {float:left; width:140px;}
.left {float:left; width:140px;}
You might have to make some cosmetic adjustments in the above code so do it at your own pace.
Making Unobtrusive Tabs
If you have been following the latest trend of Premium WordPress themes, you will notice that special tabs are used (mostly in the sidebar part) to display different content like recent posts, comments, archives etc. When you click on any tab, only the content under that particular tab gets highlighted and the rest of the tabs’ content stays hidden. This allows the blog owner to display more content in less space.
Download this file :- Domtabs
Extract the domtab.js and domtab.css files from the archive and place it in your theme folder. Now add the following code in your header.php file above the tag :-
In order to show the tabs, add the following code anywhere in the template. Try adding it to the sidebars :-
You can change the content for the tabs by altering the code within the paragraph tags and edit domtab.css file for styling information.
Listing Blog Authors
If you are running a multi-user blog and want to list authors, here is the code to do it.
Here is what the parameters do :-
exclude_admin: 0 (include the admin’s name in the authors) / 1 (exclude the admin’s name from the list)
optioncount : 0 (No post count against the author’s name) / 1 (display post count against the author’s name)
show_fullname : 0 (display first name only) / 1 (display full name of the author)
hide_empty : 0 (display authors with no posts) / 1 (display authors who have one or more posts)
Displaying Categories in a Drop Down Menu
First, add the following code to any part of your theme to show the category list. The recommended choice will be your header.php file which contains the navigation. You can add this code where the navigation ends :-
Download this file :- Category Menu and extract both catmenu.css and catmenu.js files to your theme folder. Now, add the following lines to your header.php file before the tag :-
Finally replace
with
To see the category drop-down menu in action, make sure you have categories and sub-categories set up on your blog. Also make sure that they have some posts in them.
Displaying Google Ads in only first 3 posts
Many bloggers want to display Google Ads in their first three posts only (since Google Adsense only allows 3 strips in a page) but have a hard time doing so without the help of plugins. Let me tell you how to integrate it efficiently into your WordPress theme. Open up your index.php file and look for the loop.
The loop begins here (it can differ for your theme so look for the part that displays your blog posts) :-
and this loop should end like this :-
Sorry, nothing matches that criteria.
Ideally, your Google Adsense code should be placed between the start and the end of this loop. So, just pick a position (after the title or at the end of the content) and place the following code :-
current_post < 3) { ?>
Just replace the commented line with your adsense code, save this file and check your theme. It should display three units of adsense code in your first 3 posts just like you always wanted.
Displaying Recent Comments
In order to display your most recent comments, you will have to modify your functions.php file from the theme folder. If the functions.php file is not present, make a new text file, name it functions.php and add it to your theme folder. Add the following code to it and save the file :-
') { ";
', $post_HTML='
global $wpdb;
$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,
SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC
LIMIT $src_count";
$comments = $wpdb->get_results($sql);
$output = $pre_HTML;
foreach ($comments as $comment) {
$output .= "
}
$output .= $post_HTML;
echo $output;
}
?>
Now, wherever in the theme you want to display the list of recent comments, just add this code :-
Highlighting Author Comments
It takes a bit of tweaking to separate the author’s comments from the readers’ comments. Usually it can be done by changing the color or style of the author’s comments. Here is how can go about doing the same :-
Open up the comments.php file from your theme folder and try to locate the following piece of code :-
Replace the above code with this :-
Finally, add this to your style.css file in the theme folder :-
.authorstyle {
background-color: #B3FFCC !important;
}
If you are the author and have made comments on a post, check it out. Your comments will have a different background color from the readers’ comments.
Adding a Social Bar to your Posts
Social bookmarking is important if you want your posts to reach more and more readers. Most of the times you have to hunt for a good plugin that will show little icons for different bookmarking websites under each of your posts that will help your readers to bookmark them. But it can also be done through code like this :-
Open the single.php file from your theme folder. Copy the following code and paste it within the WordPress loop (preferably after the content) that calls your post :-
Now, copy the following code to your style.css file for the theme :-
.socials {font-size:10px; font-weight:bold; margin-bottom:10px; background-color:#FFFFFF; border:1px solid #BBB9B2; padding:5px 5px 5px 10px; width:540px;}
.socials a {margin-right:10px; color:#BFBCB3;}
.btn_email {background:url(images/mail.gif) left no-repeat; padding-left:15px;}
.btn_comment {background:url(images/comments.gif) left no-repeat; padding-left:15px;}
.btn_delicious {background:url(images/delicious.gif) left no-repeat; padding-left:15px;}
.btn_digg {background:url(images/digg.gif) left no-repeat; padding-left:15px;}
.btn_reddit {background:url(images/reddit.gif) left no-repeat; padding-left:15px;}
.btn_technorati {background:url(images/technorati.gif) left no-repeat; padding-left:15px;}
.btn_furl {background:url(images/furl.gif) left no-repeat; padding-left:15px;}
Finally, download this zip file that contains the icon images for all the social bookmarking websites and place them in the images folder of your theme. Social Bar done 🙂
Creating an Archives Page for your Blog
You can create a Page Template for the archives page on your blog. Here is how to go about it :-
Create a new file called archives.php and add the following lines to it :-
The above code will give a name (Archive Page) to the template which you will see when making a new page in WordPress. Now add the following code to display a list of all your posts :-
- : ">
Finally, add this code to display categories and monthly archives :-
Categories
Monthly Archives
Save the archives.php file and place it in your theme folder. Now, create a new page and name it anything you want. Just make sure that you choose the “Archive Page” template as the template for your new page.
I hope that you liked this exhaustive collection of WordPress hacks and also hoping that it will help you in some way 🙂
128 replies on “10 WordPress Hacks to Make your Life even Easier”
Great article and very informative thanks for share it.
Quality articles is the key to attract the users to pay a quick visit the web page, that’s what
this web page is providing.
Good resources – thanks!
I got a call from some friends of mine the other day.
While it is the traditional adornment for a bar, a mirror can date what should be an exciting,
hip place to hang around. A few great art retail
websites now have images available in bespoke wallpaper murals formats which mean that decorating had never been easier.
You could definitely see your expertise in the article you write.
The world hopes for even more passionate writers like you who are not afraid to say how they believe.
Always follow your heart.
Excellent post. Keep posting such kind of information on your site.
Im really impressed by it.
Hi there, You have performed a fantastic job. I will definitely digg it and for my
part suggest to my friends. I am confident they will be benefited from
this web site.
I simply couldn’t depart your site before suggesting that I actually enjoyed
the usual information a person supply on your guests?
Is going to be back regularly in order to investigate cross-check new posts
I like the helpful information you provide in your articles.
I’ll bookmark your weblog and check again here regularly.
I am quite certain I’ll learn a lot of new stuff right
here! Best of luck for the next!
Feel free to visit my blog .
Admiring the persistence you put into your blog and detailed information you provide.
It’s nice to come across a blog every once in a while that isn’t the same out of date rehashed material.
Wonderful read! I’ve saved your site and I’m including your RSS feeds to my Google account.
Y?ur style is unique compared to other folks I’ve read stuff from.
T?anks for posting when you havge the opportunity,
Guess I’ll just bookmark this page.
nice help for simple add “social bar” in post.php 😉
thanks from Italy!
I’m extremely impressed with your writing abilities and
also with the structure on your blog. Is this a paid
topic or did you customize it your self? Anyway stay up the nice quality writing, it’s rare
to peer a nice weblog like this one today..
What’s Going down i’m new to this, I stumbled upon this I’ve discovered It
absolutely useful and it has helped me out loads.
I am hoping to contribute & help other users like its helped me.
Great job.
Thanks for finally writing about > 10 WordPress Hacks to Make
your Life even Easier < Loved it!
Нi therе tо every body, it’s my first pay a quick visit of this web site; this weblog contains amazing and genuinely good information for readers.
You know that you cannot see most of the codes on this page on a tablet, right?
Thank you for sharing such awesome tricks to make WP better and more customize. I’m using this on my WP site.
whats is wrong with my blog or code, any guide pleas?
Today, I went to the beach front with my children. I found a sea shell and gave it
to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She placed the shell to her ear and
screamed. There was a hermit crab inside and it pinched her ear.
She never wants to go back! LoL I know this is entirely off topic but I
had to tell someone!
the list was so helpful, i am glad to see one of my need for my new site. the social was great. love to see more of your list. Thanks a lot!
Hello! I could have sworn I’ve been to this website before but after reading through some of the post I realized it’s new to me. Anyhow, I’m definitely glad I found it and I’ll be bookmarking and checking back frequently!
Was looking for a nice list builder for a directory I’m working on but found some other cool tools in the process. Thanks.
can you please let me know that how did you set that social buttons at the end of the post where we roll over the icon and it stands up and comes out is there any plugin than please please let me know about it
thanks,
why cant I see most of the code snippets?
I dont want that !
is there any plugin that i can easily create a calender and then when a user click on the date then automatically comes the desire category .
interesting and detailed tutorial on WP. I am into StudioPress development, I guess using a framework to design sites have become much simpler.
Your places for code are fucked, half of them are empty (at least in chrome).
something went wrong there. thats too bad! I would love to see your hacks examples! could you please fix it?!
They’re empty in Firefox too.
Very thanks for creating such a useful post for all wordpress bloggers.
Hi ,
I love and use many wordpress hacks while i develop websites for my clients.
Thanks for sharing some of them here.
thanks for the help you give
Nice post, I especially like the tabs segment – I’m going to try that!
Thanks!
Claudia
yaayy! a god-send. I think the tabbed content is elegant and what css-oriented developers need.
Well, too sad! none aint working for my wordpress. I guess its because am using the latest version right?
good post.. nice word press hacks… i will use this tricks in my blog for sure
I really like the social bookmarking tip. Thanks for sharing.
This had made my blog simple, and more friendly to users.
Thanks for the tips.
very nice hacks, it really helps to customize things.
This list is quite helpful, thanks!
thank you … “adding social bar” article helps me alot …..
awesome
this information is exactly what I was searching for.
very nice content,i find what i need here tnx
i have a probleme with the STICKY POST, because now the post appears twice (in the loop ant at the top of the loop) ! any ideas ? thank you very much 😉
These are some really nice hacks, thanks for sharing!
I’ve been looking for these, thanks for sharing.
with a little modification of this code, i made wonderfull result 😉 thank you so much 😉
i just import the blog from old domain to new one.
i try your code for category columns on seperate page () but nothing is displayed.
whats is wrong with my blog or code, any guide pleas?
Nice article! the best one: categories columns.
thanks, especially for splitting the categories into two column 🙂
Great tips! Thanks!
very nice post. thanx
Really useful post – I have been looking for a decent Category code and this is an ideal starting point. Thanks!
I found two of this hacks usefull for me. Thanks!
preety usfeul code tweaks, wp is really flexible this days
Jai,
These are extremely useful and cool hacks!!! Thanks for sharing these in your blog.
For the last few days, I have been trying to generate at least 3 category/sub-category columns using code from “Breaking Categories into Columns”. As part of the description, you mentioned “Through the following hack, you can split your categories’ list evenly into two or more columns which can save space and not make your pages longer.” I have not been successful in generating more than 2 columns and don’t know how to change the code to display more columns. Could you please let me know how to change the code to accomplish this task? Thank you in advance for your help in this matter; it is greatly appreciated!
By the way I want to displat Category Tab instead of Page Tab at the top. Can you help me how to do that plz…
thnx so much ,every hack is just in time for me…….
will category drop down work with thesis 1.6?
thank, I was looking for drop down categories stuff.
thank you so much!
I found your blog on google and read a few of your other posts. I just added you to my Google News Reader. Keep up the good work Look forward to reading more from you in the future.
Thank you for sharing your knowledge about wordpress.
I really liked this hacks. I will try to apply on my website.
great hacks!!
excellent tips which can really made my blogging life easy..
Your spot on directions for breaking categories into two listings worked PERFECTLY. Thanks for the post!
thanks for this great tips. i will use on one of my blogs.
Great tips, I love the idea of grouping the images, do you have any ideas?
Nice infor. Thanks for shared.
just let love be
Such a great post. I’ve been wondering how to get categories into 2 columns forever. Quick question –
How can you list categories in 2 columns AND show post counts? Can you guys post the code tweak? That would be amazing.
“…. and also hoping that it will help you in some way”
Thats purely an understatement. These tips have given me what I had been craving for all these days.
Thanks for taking time and writing this up.
Great tutorial boss. Thanx a lot for sharing.
thank for you manual
Really great tips… Am waiting to try most of these hacks on my own blogs.
Thanks again!!!
Thank you so much. This is SUPER helpful!!!
Hack to split categories is not working for me.. Please give me a solution…!!!
All the hacks are essential for a WordPress blog. I was looking for a hack to split categories into two columns and I found it here… Thanks for it 🙂
Hi good day,
I have followed your tip in creating archives. But it didn’t work out. Care to help me?
Please check my site, so that you’ll understand what i mean. Click on my monthly archives and see what does it do.
Please help me. Please
the archive template page was exactly what i was looking for. displaying display_category_as_images on that page will give me a great looking landing page. thanks!
Great hacks, will definitely use some. Thanks!
Thanks for a nice list.
Great “hacks” I like some of them 🙂
Nice tips! I love tweaking WordPress.
These are some small things that you wish for a easy option, but often end up trying to work around. This makes that easy option available.
Great one, thank you very much.
Nice tricks, i’ll implement it soon.
Thanks
Brilliant list of very useful tips. I especially like the Sticky Posts suggestion. Thanks.
Great, Thanks you so much.
thanks, great list, especially for splitting the categories into two column 🙂
Awesome, as a complete newbie, these are wonderful. I am thankful to a fellow student of Alex Jeffreys for giving out this link.
dear all,
this is what i was trying to look for some times, and finally found it…. however i couldnt find the ”php wp list categories(); ” in my blogger html codes, so can u please tell me if there’s any alternative solutions to split the list of links we have?
best regards
dear all,
this is what i was trying to look for some times, and finally found it…. however i couldnt find the ”” in my blogger html codes, so can u please tell me if there’s any alternative solutions to split the list of links we have?
best regards
dear all,
this is what i was trying to look for some times, and finally found it…. however i couldnt find the ”
” in my blogger html codes, so can u please tell me if there’s any alternative solutions to split the list of links we have?
best regards
awesome tips
I don’t know where this stuff goes? Open what? a template? what if it is a free tempate? how do I open it? Dreamweaver? do I cut/paste this code into the page? at what point?
I’m new to this and can’t find a clear set of instruction on how to use any of this code. Where do you people learn this stuff?
Help!!!!
Hey! I just don’t get it. My platform is wp, I have not upgraded cuz I don´t have credits, I seem unable to make changes to the style sheet. Also I can´t edit css so I guess what I’m trying to ask here is if I can actually change anything from my template without actually upgrading?
thanks lovely
Thank you very much, it’s very useful.
Can’t Stop to post Comment for Your Valuable Work……..
i m Recently shifted from blogger to wordpress…..
And This Post is a Boom for me
Thanks
Now i m gonna check your rest of post too 🙂
very good
Thankyou for this tutorial >.</
helpfull…
thanks alot
hi jay nice post
but i don’t found some thing here
how to change theme logo
noramal text >>> graphic logo
thanks if you also add this in this post
thanks
It’s very useful for creating a new theme. Tks. Salaam.
Instead of using the Sticky note.. you can also use the shantz-wp-prefix-suffix plugin “which allows you to add any text and/or HTML/CSS code to your posts and/or pages as prefix and/or suffix. (That includes even any new or old posts and pages and even your feed)”
http://wordpress.org/extend/plugins/shantz-wp-prefix-suffix/installation/
I use that plugin together with my Adsense Manager plugin. 🙂 = Awesomeness!
http://www.mutube.com/mu/getting-started-with-adsense-manager-3x/
Interesting that you used domtab in the example, whereas your themes use tabber. Why the switch?
Thank you for this useful information. I will use them in future.
I can see that even if I am not really much of a techie guy with wordpress hacks that you are indeed enjoying what you are doing.
My brother will like this because I know that he likes hacks a lot especially if it is WP coz he even had multiple templates designed for him just to have it under his name. I’m gonna give it a shot to let him know. Thanks, Bob….
Very nice tips, applied the Author comments and Social Hack. Planning to do the archives page as well 🙂
Great!
I love your post 🙂
amazing post
Amazing!
Yet another 10 awesome hacks, Jai. I’m going to implement those tabs on my sidebar right after this.
Yan
Those are awesome hacks–You actually helped me solve a really (small) issue with the social bar and one icon not showing. Thanks for this!
Wow, thanks for the brilliant hacks!
Nice Hacks ! 😀
I especially appreciate your archives page code.
Thnk you!
This list is quite helpful, thanks!
thanks you so much.. this is very cool.. keep sharing ^__^
very useful! 🙂 Thanks for the nice article. All tricks above obviously make my life even easier.
Great post…very informative.
Great, Thanks you so much. I’ve learned a lot and will make my wordpress blog more better
great
thanks so much
Nice work on all of these! I know what I’ll be implementing in to my sites tonight! 😀
Thanks a lot for these plugins Jai
Nice Work
Totally awesome man!, this is what I’m looking for.
Thanks man
You have done this guides really good. Good job and keep going!
awesome guides!
many thanks!