Snippets Archive

Codes that are meant to be useful for others. Commercial use of my code strictly prohibited.

Sanitizing Integer Value with Filter Var

In one of my previous post, I discussed how validate integer variable. However, I recently came across some weird issue while sanitizing an integer ...

Retrieve Simple JSON API Data in PHP

Today I will share a simple PHP script to show how you can retrieve API data using PHP. For demonstration purpose I will use freegeoip ...

Validating Integer in PHP

Every now and then we need to check if the value of a variable is an integer or not. Recently I came across a forum thread where someone is trying to understand why his/her snippet is not giving the appropriate result that he/she is looking for ...

Disable Right Mouse Click for HTML5 Elements

As HTML5 becomes the industry standard markup language for developing web pages, the usage of newly introduced elements are increasing and it will continue (more likely) to grow ...

Query Posts Based on Serialized Meta Value

Recently I was working on an "inventory management" system where we I had to work with lots of products and their variations in color, size, sku, upc code, dimensions, price & other related data ...

Add GTIN for Simple WooCommerce Product

Recently I discussed about Google Merchant Center and how we can take advantage of simple snippet that can allow us to generate product feed automatically from WooCommerce as we update or add new product ...

Generate WooCommerce Product Feed for Google

WooCommerce based store owners can easily take advantage of Google Merchant Center to promote their merchandise through Google Shopping and increase sales ...