How to Add custom attribute to image using the_post_thumbnail

How to Add custom attribute to image using the_post_thumbnail

How to Add custom attribute to image using the_post_thumbnail Sometimes you will need to add a custom attribute to an image. This is very easy to do using the_post_thumbnail() function. The following snippet will add the custom attribute of 'itemprop="image" to your images but you can change that to nearly anything including class, alt, title etc.
How to Track post views without a plugin using post meta

How to Track post views without a plugin using post meta

How to Track post views without a plugin using post meta Use the following snippet to track post views on your wordpress blog. The first thing you want to do is add this snippet to the functions.php of your wordpress theme. Follow step 1. and step 2. to track and display the number of views for each post. Updated this snippet from my original post on March 3rd, 2011 to Included a option for Fragment Caching so this snippet will work even on cached pages.