Code

While there are 26,410 plugins available in WordPress plugins respiratory which have been downloaded 500,583,147 times and even still counting, but still what you in seek of from time to time is some short codes – snippets – which by adding your theme files will give the desired result. These short codes can be of anything, depends in particularly that what you are planning to achieve by this. To ease your job of finding the right “required” snippet for your WordPress site, we have collected the best those snippets for you. We have divided the article in three-part series so that you can have all in your collection equally.

To check if the current post is a custom post type

Simply paste the code into your functions.php file and you will be able to check that if the current post is a custom post type or not.

While add the function can be used outside the loop:

Source: Snipplr

View all WP query variables

On pasting the code below on any files, you will be able to display the WP Query variables.

Source: WP-Mix

Conditional tag for blog-related pages

Adding the code into your functions.php template will let you know that whether you are on blog-related pages or not.

Source: ClickNathan

Automatically remove short words from the URL

Adding the code into your functions.php file will let WordPress automatically remove short (less than 3 characters) words from the generated permalink.

Source: WPSnipp

Check whether a plugin is active

Adding the short code in your theme file will let you check whether a plugin is active or not.

Source: WPMayor

Force specific pages to be SSL secure

Just add the following article to the functions.php file of your WordPress theme and specify the post or page ID desired.

Source: WPSnipp

Crop uploaded images

Add the code below to your functions.php file will let you crop uploaded images.

Source: WP-Snippet

Setting up different admin and theme languages

Simply set the desired locale followed by adding the code to your functions.php file.

Source: WP-Snippet

Using WordPress Shortcodes In Theme Files

To use a shortcode in a theme file, simply use the do_shortcode() function.

Linking Twitter usernames in WordPress

Simply add the short code in your functions.php template and it will let you automatically linked all twitter usernames in posts and comments to their Twitter profiles. Usernames have to be written under the form @username.

Source: Snipplr

Photo Credit: Flickr/Michael Himbeault

Note: Like the post, then make sure you do follow and like us on both Twitter and Facebook.