Short Codes – the way to solve small issues in your WordPress blog. While there are plenty of plugins available out there to help you out with numerous small and big WordPress roles but sometimes and sometimes even more often using the short codes will help you out more. In this article, we present the second part of three-part series of WordPress Snippets Collection.

Suggested Reading: WordPress Snippets Collection Part – 1

How to automatically insert a list of related articles below the post

Copy and paste the following code into the functions.php file and once you are done, open your single.php file and call the function using the second code below.

Code 1:

Code 2:

Source: WP Tuts

Adding nofollow attributes to all links in a specific category

Copy the code below and paste it on your functions.php file.

Source: Sagive

Automatically spam comments with a very long url

Adding the code to your functions.php file will automatically mark as spam all comments with an url longer than 50 chars.

Source: CSS Tricks

Translatable JavaScript strings on your WordPress theme

Simply paste the following code into your function.php file, where you generally enqueue scripts and styles.

Source: WP Theming

Adding SVG upload support to your WordPress blog

Simply add the code below to functions.php in your WordPress theme.

Source: dbushell

Create a directory within the uploads folder

Adding this code snippet on your functions.php file (or plugin file if you’re creating a plugin)

Source: WP Mayor

Display an author bio excerpt

Paste the following code into your functions.php file.

Source: SEO Review Tools

Detect a comments page

Adding the following code anywhere on your theme files will return true if you’re on a comment page.

Source: SEOMix

Force your WordPress blog to break out of frames

Just paste the code below into your functions.php file, save it, and you’re done.

Source: WP Mix

Redirect to post if search results only returns one post

Paste the following code snippet into your functions.php file.


Display the author posts in the admin post list

Adding the code into your functions.php file will let authors only see their own posts in the admin post list.

Source: WP Snippets

To run the loop outside of WordPress

Paste the following code on any PHP file where you want to run your WordPress loop.

Source: CSS Tricks

Allow more HTML tags in WordPress comments

Simply paste the following code in your functions.php file.

Source: David Walsh

Function to show a total share counter (FB, Twitter, G+)

Simply paste the following function where you want your counter to appear.

Source: Gleenk

Photo Credit: Flickr/Chris Hsia

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