Today, you’ll learn how to add a Pinterest button to your WordPress site without using a plugin.

This tutorial is made by Marvie Pons of TutsKid and it’s pretty simple and easy to follow. Like with most, if not all WordPress tricks, all it takes is appending a few lines of code in your functions.php file. Simply copy and paste the code below:

The first function automatically gets the first image from the post to be pinned and the post’s permalink. And just like with the plugin, it will let you edit the description and the URL before posting. The second function adds the Pinterest JavaScript in your blog’s footer.

If you want to put the horizontal or no count share button, you can simply change the count-layout parameter to horizontal or none. And if you only want to show the button on single posts, pages, and attachment pages, just add the following tag on line 21: