Category: 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
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
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
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…
-
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…
-
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…