Famous Bloggers

3 Simple And Handy WordPress Tricks Without Using A Plugin

WordPress Tricks

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?

Exit mobile version