WordPress Code Snippets

A fresh mix of code snippets and tutorials

Create a WordPress shortcode

45

Creating your own custom shortcodes is another thing that WordPress makes very easy to do.

Add this to your theme’s functions.php file:

function i_love_you() {
	return 'I love you.';
}
add_shortcode('luv', 'i_love_you');

Then to show some love anywhere in your posts or pages, just type the following shortcode:

[luv]

Much more is possible, visit the WordPress Codex for more infos.

Learn more

WordPress Themes In Depth


Show Support

Like our new Facebook Page to show support!