56Reactions
WordPress Tricks

3 Simple And Handy WordPress Tricks Without Using A Plugin

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?

Sassy blonde mom from Southern Illinois who is a Professional Blogger, AND a WordPress web designer and developer. Nile loves to help others rock out their blogs and social media handles. If it was not already apparent, she is addicted to WordPress, Blogging, Social Media, and in general, anything about the Internet. It is not uncommon to see her speak at WordCamps (WordPress conferences) and blogging conferences across the United States. Her website is Blondish.net.

GET FREE EMAIL UPDATES

Get our latest articles delivered to your email inbox, plus download our FREE 15 minutes later marketing guide.

We respect your privacy!

{ 29 comments… add one }

  • Jeff December 5, 2013, 1:48 am

    Thank you!!! After searching everywhere for a plug-in or code to insert thumbnails into my excerpts, this did the trick. And I learned a bit more about how Wordpress works. You’re a lifesaver!

  • Jack October 24, 2011, 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 PlatformMy Profile

  • Nicole Hanusek May 11, 2011, 5:35 pm

    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!

  • Nick March 20, 2011, 12:10 pm

    any one here help with my site pls

  • Nick March 19, 2011, 6:49 am

    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?

  • Vijayraj Reddy February 9, 2011, 4:28 am

    i have lowered the Limit Excerpts as it was exceeding my thumbnail image…

  • Darren Scott Monroe February 6, 2011, 3:55 am

    Hey Niles remember when it used to be MAJOR difficult to even setup let alone HACK wordpress to your advantage? LOL Hey good ideas .

  • Rodger January 28, 2011, 10:46 am

    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.

  • Dvd Training Video November 30, 2010, 11:05 am

    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 CommentatorMy Profile

    • Codrut March 11, 2011, 6:01 am

      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 InternetMy Profile

  • AJ November 10, 2010, 3:43 pm

    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!

  • Asad June 17, 2010, 11:34 am

    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 TemplatesMy Profile

  • sağlıklı diyetler April 22, 2010, 11:28 am

    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 =-.

  • Blogging Tips April 6, 2010, 5:37 am

    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 =-.

  • Onibalusi Bamidele April 5, 2010, 4:31 am

    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 =-.

  • Josh Kohlbach April 5, 2010, 2:12 am

    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 =-.

  • Dave Doolin April 4, 2010, 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… =-.

  • Dave Doolin April 4, 2010, 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… =-.

    • Nile Flores April 4, 2010, 5:58 pm

      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.

      :D
      .-= Nile Flores´s last blog ..What Makes a Successful Blogger? =-.

  • Dennis Edell April 4, 2010, 1:09 pm

    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 =-.

    • Nile Flores April 4, 2010, 6:09 pm

      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? =-.

      • Dennis Edell April 5, 2010, 5:32 pm

        Just to simplify, I will still send full feeds, yes?
        .-= Dennis Edell @ Direct Sales Marketing´s last blog ..Comment Contest and Bonus Winners – March! =-.

  • Anne Moss April 4, 2010, 12:18 pm

    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 =-.

    • Nile Flores April 4, 2010, 6:13 pm

      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? =-.

  • Gautam Hans April 4, 2010, 8:13 am

    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 =-.

    • Nile Flores April 4, 2010, 6:10 pm

      2.9+… you are correct. :D

      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? =-.

Leave a Comment

CommentLuv badge