Simple Post View counter for WordPress

Right now I’m working on a redesign for TexturePlanet.
Up until now I was using Detube theme on TexturePlanet, and it was really more like in an experiment stage to test if people are still looking for textures, and they are.

The Detube theme was using WP-Post-Views wordpress plugin, but folks over at WPengine didn’t like that, so they kindly pointed me to WPSnippets as a “how to update post view count”. At the moment, I’m trying to simplify simplify, so I don’t mind the technique. But the code seemed a bit too wet for my taste, so here is my take on it. It’s the same technique, I’ve just adjusted it a bit.

The usage remains the same as instructed on WP-Snippets. You just do:

  • Thanks for improving this snippet, the one on WPSnippets wasn’t quite to my liking, and I prefer your coding style (more like mine!), so I can understand it a lot quicker.

    One question – I’ve just started experimenting with custom post types for a job board I’m creating.
    Which parts do I need to swap out to make it work for my job_listing CPT? Or does it work out-of-the-box with CPTs as well?

Leave a Reply

Your email address will not be published. Required fields are marked *