Category: PHP

  • How to add a virtual page in WordPress?

    How to add a virtual page in WordPress?

    There are many use cases for a virtual page. Let’s say showing the invoice or payment status page for a payment plugin in the front-end, without compromising active theme. I needed one recently to show payment statuses. Here is how I implemented it. 1. Hook “init” to catch the specific slug First we need to […]

  • Translate WPML via WordPress REST API

    Translate WPML via WordPress REST API

    Although REST API is now included into the WordPress core, WPML – one of the most popular translation plugin – still didn’t catch up to that. Anyways, after extensive googling I decided it’s better to implement the feature myself. Here is how the translation worked. Step 1: Add a custom end-point I added an end-point /translate to do […]

  • Upload media via WordPress REST API

    Upload media via WordPress REST API

    WordPress REST API is quite interesting especially when you are trying to update the website from some third-party resources. Recently I had to implement a similar feature where most of the things like custom post type, taxonomy etc. worked as they should except images. So, here I’m going to show how I made the media […]

  • WPML URL override on archive page

    WPML URL override on archive page

    Last week I ran into an issue with WPML URLs on post type archive page. When the permalink is set to %post_name%, we can access the archive page following //site_url/post_type_slug. And the posts can be filtered by taxonomy using //site_url/post_type_slug?taxonomy_name=taxonomy parameter in the URL. With WPML language switcher things become a bit tricky. The issue When I […]

  • Showing countdown timer in email

    Showing countdown timer in email

    Last day I received an email newsletter which contained a countdown timer in it. It was quite interesting because most of the times emails are static and we are unable to show any dynamic data. Then again, there is the GIF image format which can show animated images. From investigating the source I figured that they […]

  • Email Obfuscation – WordPress Shortcode

    Recently I was working on a WordPress website and was into a situation where I wanted to protect the email address from spam bots but also didn’t want the legitimate users to go through the trouble of filling out captcha and click an extra link. WordPress do have a nice function called antispambot which does it […]

  • Useful extensions for Laravel

    Useful extensions for Laravel

    I’m starting to love Laravel. And while starting new project, there are few extensions I like to use which saves a lot of time. Maybe someone else will find these useful as well. 1. Laravel 4 Generators A really awesome extension from Jeffrey Way. This makes life easier by creating all the controllers and models […]

  • CodeIgniter template library

    CodeIgniter template library

    The thing I hate most about CodeIgniter is that the views folder become messed up after a while. So many files and so difficult to track down a view for a certain area of an application. So, to solve that I figured I should create a library to override the ways of managing views. I wrote this […]

  • Shortcode for Contact Form 7

    Shortcodes are widely used feature of WordPress. Many plugin and theme developers use this interesting feature to easily push custom contents inside posts or pages. But what if we could add a custom field within a Contact Form 7 (wpcf7) form? That’s exactly what I tried to do couple of days back and it was […]