As A WordPress user of more than 6 years, and before that a b2 user, I really have come to appreciate the advancement of this content management system. However, there are a lot of people relying on a little too much on plugins. It is not necessarily a total faux pas to rely on them, but you certainly can eliminate a few unnecessary processes that could run up your database resources.
So, let’s start…
Simple tricks you can add to your WordPress site without a plugin!
These tricks you can copy and paste into your theme’s functions.php file. Sounds simple, right? It really is!!!
Limit Excerpts
This simple trick will help you specify how long you want your excerpt to be. For those who want a good example, Blondish.net, my site exercises this trick as well as the others in this article. Copy and paste the code into your functions.php page. To specify the number of words you wish your excerpt to display, change the default number 75 to the number you want. For example, on my site, I use 100.
add_filter('excerpt_length', 'my_excerpt_length');
function my_excerpt_length($len) { return 75; }
Theme Support For Thumbnails
Thumbnails have become really popular and there are a few variations of this trick. However, there are few that actually delve into talking about theme support. This little snippet of code will allow you to choose a thumbnail by loading one up to your WordPress media library.
In order to do this, you need to copy and paste the following code in your theme’s functions.php.
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 200, 200, true ); // Normal post thumbnails
add_image_size( 'single-post-thumbnail', 400, 9999 ); // Permalink thumbnail size
After you have added the above code to your functions.php file, you can add this to the index.php and single.php files if you want. This requires inserting a code into the layout to call the thumbnail into the post.
<div class="attachment-post-thumbnail">
<?php the_post_thumbnail(); ?>
</div>
Once you do this, you need to adding into your style sheet some CSS. For example:
.attachment-post-thumbnail {
float:left;
margin:5px;
}
When you go to post, there should be a new field box that says “Thumbnail” that you can set your image. Load it up, and right next to the button that says “Insert Into Post”, is “Set Thumbnail”. Click that and when you publish your post, your thumbnail should show up.
Replace Excerpt Ellipse
A lot of people really do not like that WordPress puts in excerpts an ellipse. An ellipse is famously seen as [...]. A lot of times this does not have a URL. For those who use excerpts, you can replace the More or ellipse with a filter in your functions.php file of your theme. For example, I use Read More and have the article’s permalink anchored.
function excerpt_ellipse($text) {
return str_replace('[...]', ' Read More →', $text); }
add_filter('the_excerpt', 'excerpt_ellipse');
Each of these also have plugins that do similar jobs, but why use the plugin and use extra space? Keep it simple!
Do you use something similar? Does your theme already come with some of these functions?





{ 28 comments… read them below or add one }
Twitter: Anishg6
October 24, 2011 at 5:11 am
Thanks for the codes, Nile! I had been having some issues with my thumbnail images earlier. The code you gave solved them!
Best regards,
Jack.
Jack recently posted..Best eCommerce Platform
Thank you for sharing this, it just solved a featured image problem for me. And now that I know about it I’m sure it will come in handy for future projects!
any one here help with my site pls
huh ?! :s
Nasif recently posted..Another Very Important Arm of Broadband Internet Satellite Internet
Hi, your code is not work on my theme as i use http://wordpress.org/extend/themes/easel, which you can see my site http://www.nsneakers.com.
The problem is the featured images can’t get Thumbnailed, it only shows full image size on post, index, category and tag.
Other Thumbnail images in the post work fine.
Can you help?
i have lowered the Limit Excerpts as it was exceeding my thumbnail image…
Hey Niles remember when it used to be MAJOR difficult to even setup let alone HACK wordpress to your advantage? LOL Hey good ideas .
WOW. Thank you. I didn’t know how to remove the ellipse. It is quite annoying, since it doesn’t do anything, and now I can link to the article.
I rarely do manual tweaks because I’m always concerned about theme updates and losing any changes I’ve made. I did break down last night and actually edit a php file to add a slide out tab! : )
Anyone know of a really cool way to create a tab slide out that allows resizing of the widow to exact desired dimensions? I want to place a YouTube video in the slide out winow.
Dvd Training Video recently posted..DoFollow CommentLuv KeywordLuv TwitterLink Top Commentator
You’re right. I’m not a coder, so I dislike breaking codes. That’s why I prefer plugins. So more to tweak without a single html code touch.
Britt, you might look up for a Youtube related plugin that does that, did you try finding one yet?
Codrut recently posted..13 of the Best Squeeze Page Examples on the Internet
Nice quick tips – I am a huge fan of manual work as opposed to using plugins. It is a great way of keeping your site fast!
Post excerpts are really good for seo of the blog and save your blog from duplicate content penalty of search engines.
Asad recently posted..Top 10 Amazing Girly Blogger Templates
From starting to the ending ,it is just great .Thank you veyr much .
.-= NEW from sağlıklı diyetler´s last blog ..Güney Sahili Diyeti =-.
Gr8 ! I am a newbie to WP and this is really helpful to me.
.-= Blogging Tips´s last blog ..Blogging Tips Contest – Win upto $180 worth prizes =-.
This is really a great post explaining some basic things about wordpress. I never thought all this can be done just by editing some line of codes.
Thanks
.-= Onibalusi Bamidele´s last blog ..Google Pagerank Update 2010 is complete =-.
It’s surprising how much you really can achieve without the over use of plugins. I’m with you, I think people rely on plugins far too much instead of taking the time to understand some simple theme programming.
I personally developed a new site with the intention of making less use of plugins to make the site faster. I’ve done a few of these tips including the thumbnail one and the excerpts limiting. It’s really not that hard.
.-= Josh Kohlbach´s last blog ..StumbleUpon: My Stumble Your Own Stuff Experiment =-.
Now sure how simple it’d be. Yes, it takes time but I think it’s more about the fact that bloggers have been conditioned to using plugins instead of manual code cracking.
Codrut recently posted..13 of the Best Squeeze Page Examples on the Internet
Twitter: websiteweekend
April 4, 2010 at 3:25 pm
I should add, these are *excellent* little suggestions, the excerpt example in particular is something I’ve been needing to get handled.
My previous comment is probably a little too far down the rabbit hole!
.-= Dave Doolin´s last blog ..Writing About Money on Easter Sunday? Yes! And here’s why… =-.
Twitter: websiteweekend
April 4, 2010 at 3:23 pm
Well, this is all cool, but plugins allow for theme-independent code.
Given adding code to functions.php or writing a little plugin for my own use, I’m as inclined to write the plugin. That way I can at least track my code in subversion or git, and never, ever have to worry about functions.php getting stomped by an upgrade or whatnot.
I have to admit I don’t have that much WordPress experience… but I’ve been coding C since 1994, and the worst complexity always erupts on the code management side, not the code itself. I understand the penalty for reading yet another file from disk, but caching takes care of some of that, and the benefits for managing my development process are very strong.
.-= Dave Doolin´s last blog ..Writing About Money on Easter Sunday? Yes! And here’s why… =-.
Actually these snippets are theme dependent… not the plugins. For example… these work like framework themes do like Thesis to add more functionality to both the front end and the back end without messing with the core or using database space.
.-= Nile Flores´s last blog ..What Makes a Successful Blogger? =-.
Twitter: websiteweekend
April 4, 2010 at 6:07 pm
Nile, rereading both your article and reply, I think we’re in “violent agreement.”
I signed up for your RSS feed, I should poke around your site a bit before going further.
BTW, if you’re interested in WP plugins, hit me up.
.-= Dave Doolin´s last blog ..Writing About Money on Easter Sunday? Yes! And here’s why… =-.
Do the two excerpt tricks interfere with a full feed? This is why I use a plugin for it.
.-= Dennis Edell @ Direct Sales Marketing´s last blog ..Blog Comments and Blog Comment Contests – Lets Chat about Paying for Comments =-.
Hi Dennis! No, these only effect the_excerpt filter in your theme layout, not something like your full content posts and your RSS feeds.
.-= Nile Flores´s last blog ..What Makes a Successful Blogger? =-.
Just to simplify, I will still send full feeds, yes?
.-= Dennis Edell @ Direct Sales Marketing´s last blog ..Comment Contest and Bonus Winners – March! =-.
Good to see someone actually working with a few lines of code rather than a plug-in!
.-= Anne Moss´s last blog ..Amazing Grace – Cirque Du Soleil Juggling Show =-.
Thanks! It is just much more logical to try to keep these type of functions simple rather than elaborate it with a plugin that takes a lot more time. The functionality is there already so these work with those attributes rather than go the round about way.
.-= Nile Flores´s last blog ..What Makes a Successful Blogger? =-.
I think the thumbnail hack works for wordpress 2.9+ and i have recently employed it to my blog and found it to be really impressive. I personally liked the excerpt hack and will emply it in my blog
Thanks for the tip
.-= Gautam Hans @ Blog Godown´s last blog ..5 Conversion Rate Optimization Tips for Bloggers =-.
2.9+… you are correct.
I found it much easier to incorporate into a layout versus other thumbnail hacks… plus, it works with your WordPress Media Library.
.-= Nile Flores´s last blog ..What Makes a Successful Blogger? =-.
{ 5 trackbacks }