How To Hide Opt-ins In WordPress Using jQuery?

In this post I’ll share how I managed to hide an Optin, that did not hide as expected even after changing the settings in the OptinMonster plugin.

I’ve been working on one of the WordPress projects, that uses OptinMonster a lot. If you’re new to OptinMonster, then checkout OptinMonster’s website to learn what it is and what you can do with it.

What Problem Did I face?

The client wanted to show Optins only for logged-out Users yet the Optins’ were popping up even for logged-in users. Normally, we can use Optin Monster’s output settings to hide Optins to logged-in users. But in my case, this did not happen and the Optins continued to pop up for all users.

How Did I Solve?

Having tried the display settings in the Optin Monster plugin, I found from their docs that I could use their Javascript events API to stop Optins from popping up. I plugged the following snippet only to logged-in Users using wp_enqueue_script function and Conditional tags.

This snippet will be handy if you happen to deal with Optins that are real monsters.

Flipkart? A Big No!

In this blog post, I’ll share my Flipkart shopping experience that eventually led me to stop buying from Flipkart.

My intention in this post is to not to stop you purchasing from Flipkart, rather to share my experience so you can decide for yourself.

Upgrading To K6 Power From K4 Note

I have been using Lenovo K4 Note since its launch in Feb, 2016 and I was happy with the overall experience. I liked the responsiveness of Lenovo K4 Note and did not like the touch experience in other Android phones, in similar price range. Being a happy customer of Lenovo K4 Note, I decided to upgrade my phone when Lenovo announced the launch of Lenovo K6 Power.

Raising Return Request After Phone Was Found Defective

Lenovo launched the K6 Power through their online retailer, Flipkart. I purchased the K6 Power from Flipkart on Feb 23, 2017. Within the first few days, I discovered that the other party with whom I was on call was not able to hear my voice. When I used a different phone this was not the case. So, I found that the phone was defective and raised a return request on Flipkart. The return process involves a technician visit to investigate the phone and then approve/deny the request based on the investigation.

Flipkart’s Way Of Saying No

While raising the return request, I specifically mentioned that the technical visit has to happen at a different address than the original purchase address. I was promised by Flipkart’s customer support team that the change in address was taken care of. Two days later, I received a call from Flipkart’s technician asking for my purchase address to investigate the phone. I replied him saying the technician visit has to happen in a different address than the original purchase address and this was conveyed to Flipkart. He then asked me to check with Flipkart customer support team to get the address issue clarified.

The following day, I received an SMS from Flipkart saying that the Technician visit was cancelled without specifying the reason. This sounded rude and disgusting to me.

Flipkart Covers Mistakes By Apologies

When I called Flipkart Customer support team to check the reason why the technician visit was cancelled, they apologized without giving me a reason. I called couple of times and found the reason updated on Flipkart by the technician was that the customer was not reachable on phone. This was painful to know because the technician spoke to me and advised to call Flipkart customer support team.

At this juncture, I was totally pissed off because I made sure that the change in address was notified to the Flipkart customer support team during my first call to Flipkart. I, again, called the support team and got my technician visit scheduled. And once again, they sent an SMS after 5 days saying that technician visit was not possible. And this time I found that it was because I fell out of the replacement window. The replacement window is 10 days from the purchase date. Each time, I called the customer support team, I had to explain the whole story and had to undergo lot of mental stress.

Flipkart Responds Only To Social Shouts

I, then, chose to take this issue to social media and notified Flipkart via Twitter. I got a call from the Social media team asking about the problem that I faced. I had to repeat the whole story again and they scheduled the technician visit to the new address. At this juncture, I already lost the trust which I had on Flipkart. Having spent about 10,000 INR, I badly wanted to get my phone replaced.

I was waiting for the call from the technician and when the local support team called me to check my availability, I mentioned that I would be available in the morning between 9:00 and 11.30. They replied back saying they would send the technician during the specified hours. But on the specified day, no one turned up and I was frustrated. And later in the day, the same person from the Flipkart’s local support team called and asked if I would be available in the evening. I replied them saying that I would be available only in the morning and they could re-schedule the visit on the following day.

Finally Got My Phone Fixed

Two days later, the technician arrived during the time I specified and investigated my phone. After a while, he said he had fixed my phone. I checked the phone myself and found it to be working. Though my phone perfectly works yet I completely lost the trust on Flipkart. Since then, I decided not to buy from Flipkart and I don’t recommend it to my friends, either.

More than spending money, the stress I had to undergo was huge and I have beautiful things to do in my life rather than repeatedly calling Flipkart customer support. I’ve, also, stopped recommending Flipkart to friends and family.

How To Install MySQL Using Homebrew On Mac OS?

In this post, I will be walking you through how I installed MySQL on my MacBook Pro.

I, recently, purchased a MacBook Pro and this serves as the go to toy for all my programming stuffs that I do at home. Mac OS is fairly new to me and I wanted to install MySQL on it, to play with WordPress installations locally.

I will be using Homebrew to install MySQL on Mac OS. Homebrew is the package manager for Mac OS and I highly recommend it. If you are new to Homebrew, then I recommend that you read this post from Tutsplus before you continue reading further.

Now that you know what Homebrew is, let me show you, how I installed MySQL on Mac OS.

If you haven’t installed Homebrew already, on your Mac OS, you can follow the install instructions on Homebrew website to get Homebrew installed. Let’s brew it!

Step 01: Fire up the Terminal and execute brew doctor. This command checks for potential problems with Homebrew. You can ignore the warnings that you get when you run this command, but not errors.

Step 02: Now, run brew update to update Homebrew and all new formulae.

Formulae are instructions for Homebrew on how to install specific software and where to find the necessary files and dependencies.

Step 03: Now we can install MySQL by running the command brew install mysql. Now you can sit back and relax while Homebrew installs MySQL and it’s the dependencies.

Once installed, you can connect to MySQL using the command mysql -u root.

You can continue using local MySQL without a passowrd. But, I prefer to secure my local installation and in order to that, we can run the mysql_secure_installation command. Setting the password, from here on, is self explanatory.

Below are all the terminal commands needed for the complete installation of MySQL.

What’s After Schooling?

Honestly, I did not have an answer myself when I completed my schooling. I feel obliged to share few thoughts that I observed after attending a seminar organized for students who are aspiring to choose a path after schooling.

Today, I, along with my family, attended a seminar organized for students who are aspiring to choose a path in life after schooling. The seminar was organized by and conducted at Knowledge Institute of Technology, Salem.

I feel responsible to share, a few thoughts after listening to Mr. Sujith Kumar’s speech. This post is to help students and parents who are trying to figure out the best course and the college.

Sujith needs no introduction, but if you haven’t heard about him and his work, then read this article on The Better India.

Sujith’s speech was focussed on what parents and students must do after schooling. I wanted to share the core of his speech because his words should reach and help the other folks out there.

Here are couple of thoughts to parents and students from Sujith.

Few Thoughts To Parents

  • Listen to your children even if they share things that doesn’t makes sense. The key here is to communicate, listen and understand their interest in life.

  • When you and your child doesn’t really know about the courses to pursue after schooling, get advice from a Career Counsellor.

  • Don’t let the Counsellor make a choice for your child. Instead, get to know the options and let you and your child choose the best.

  • Understand that your child has his own weaknesses and strengths as well. Appreciate his/her strengths, motivate them, talk to them and embrace their failures.

  • Never, ever, compare your child with other children. Everyone is unique. What works your friends/colleagues children may not work for your children and understand this it is the vice versa.

  • Don’t force your dreams on your children. Fulfilling your dreams through your children is a crime. Instead, share your dreams, and let your Children pursue it, if they’re into it.

Few Thoughts To Students

  • 99% of the students do not have any idea on what they want to pursue. So, Students must listen to their parents.

  • Talk to your parents frequently as you do with your friends.

  • Visit the colleges, that you have in mind, with your parents, and talk to the students who are studying in the college. No one else can tell you better about the college.

  • Choose a college that invest in Training faculties and studies rather than colleges that invest in Infrastructure development.

  • Students, understand, that if you have three meals a day and a roof to sleep, you’re fortunate that many others out there. It is a luxury that many students of your age lack today.

  • We’re now in the fourth industrial revolution and we expect job losses due to automation and the technology advancement. So it is not only important to learn things by understanding them, but also, invest time online beyond your college books to acquire deep and additional knowledge on your subjects and produce things, to stand out.

How To Add/Remove Multiple Attributes Using jQuery?

Are you using multiple jQuery statements to add or remove attributes to/from HTML elements? In this post, I’ll share with you, how you can achieve the same in one go.

Recently in one of the projects I was working on, I had to swap attributes between two HTML elements. So I was looking out to see if I could do it in a single statement rather than adding/removing one after the other. Guess what, jQuery has a way do it.

If you’re new to jQuery and looking to include jQuery in your project, you might want to checkout getting started with jQuery.

Let us set up the stage first. We shall include <input> elements. The class on the input elements should help you to identify what we’re about to do on that particular element.

Assuming you have jQuery loaded, let us use jQuery to add/remove multiple attributes.

First, let us remove the attributes id and name and then on the second input elemement, we shall add the id and the name attributes.

In order, to remove multiple attributes, use the .removeAttr() method and separate the attributes with a space. And, to add multiple attributes, we must use Plain Object of attribute value pairs in the .attr() method.

The PlainObject type is a JavaScript object containing zero or more key-value pairs.

You can find the full working demo from JSFiddle.net. I hope you found this tutorial helpful.

References:

2016: My Year End Reflection

2016 was a special year for me and was the year of changes in my life. I shifted my career towards WordPress in 2016.

This is the first time in my life, I’m taking time to sit down and reflect on the course that I traversed over the past 52 weeks. I’m writing this year end review to keep me accountable as I had bid goodbye to my steady job to pursue my interest in developing WordPress and web applications.

I started the year 2016 with a major focus on the following areas.

  • Blogging
  • Attending a tech conference
  • Learning WordPress
  • Travel
  • Reading

Blogging

I launched this blog with a typical Hello World post on January 1, 2016. I have been writing blogs even before 2016, but I was never serious about it.

Starting 2016, I wanted to blog consistently. I had initially planned to write one post per week. Looking at the numbers, I had written only 13 posts all together in the year 2016.

Though I did not hit my mark, I’m happy that I started this blog. By the way, the Hello World post idea was inspired from Sudar’s blog.

Attending A Tech Conference

I have never been to any technical conference before 2016. This was in my to do list for a long time.

Early 2016, I’ve been put up, to work on Oracle PL/SQL project in my full time job and that pushed me to find a conference around the Oracle PL/SQL subject. I assumed that attending a conference could help me speed up my learning process and of course, it did. Eventually, I discovered OTN Yathra, a conference conducted by Oracle ACE folks to share the knowledge on Oracle products. I even wrote a blog post sharing my experiences and takeaways.

Learning WordPress

Building web applications is something that I enjoy doing and my interest grew multiple times, when I discovered WordPress, a few years ago. Learning to develop WordPress powered websites/applications was very challenging to me at that time. But the desire to do has been lingering within me, since then. So in 2016, I made up my mind to learn WordPress, no matter what.

I soon realized that I can learn WordPress quickly by contributing to open source WordPress projects. I began my contributions by sending the first pull request to the Easy Retweet WordPress plugin.

Later, I contributed to Email Log, a WordPress plugin that logs the emails sent. Sudar, the plugin author was kind to mention about my contributions in his blog.

I then, took part in the Hacktoberfest challenge by contributing to Yapapaya’s Live Comment Preview plugin and completed the challenge. Yapapaya was kind to share about my contributions in their Hacktoberfest story.

On the whole, I had spent about 155 hours in 2016 on learning/contributing to open source WordPress projects.

My WordPress Contributions in 2016

Eventually, these contributions paved my way to land a full time job as a WordPress developer.

Travel

In the beginning of 2016, I had planned to travel to at least one destination that I have never been to.

I flew to Goa with my buddies in the month of March. Not only this was my first flight but also it was one of the best trips in my life. On the whole, the trip was totally refreshing, adventurous and exciting.

If you plan to visit Goa, don’t miss out – Parasliding, Parasailing and Water Scooter riding.

Reading

I wanted to pick up the habit of reading books. Well, a year passed by and I found that I did not make much progress in reading in 2016.

2016 was a year of changes in my life and I’m very happy about what I did in the past 52 weeks.

In 2017 my focus would be on the following areas.

  • Becoming a better WordPress developer
  • Blogging
  • Reading

How was your 2016? I’m interested to know what have you planned to focus on in 2017. Please share it in the comments section below.

How To Disable JetPack SSO In Local/Staging Site?

Are you unable to login while setting up a development environment from a production site that uses Jetpack’s Single Sign On(SSO)?

I was trying to set up a local (development) site for my personal blog. Since I enabled Jetpack’s SSO, the local site redirected to SSO page and took me to my live blog’s Dashboard page. So, I was looking for a way to disable Jetpack’s SSO.

Here is how to disable Jetpack SSO and login to your local/staging Admin dashboard.

Step 01: Disable the Jetpack plugin

You can rename the Jetpack plugin folder and this will disable the plugin without logging into the Admin dashboard.

Step 02: Access the login page

Once you disable Jetpack plugin, you can access the /wp-login.php (login page) of your local site.

A New Job At Anatta Design

Having decided to steer my career toward WordPress, I started contributing to open source WordPress plugins. These contributions eventually led me to a new job at Anatta Design.

My colleagues would always tell me that switching languages is a bad idea. They would insist that affects career growth and the pay. By the time I left Infosys, I realized that I had written production code in five different languages. Most of these on my own will and sometimes, out of project necessity. Having experienced the exposure to different technologies, I felt this exposure is an added advantage. The diverse experience puts you in different perspectives to understand a problem in first case, and also when you’re trying to solve the problem.

Solving problems is what I enjoy the most. Technologies and languages helps you to do that in different ways.

Why Anatta Design?

After the initial calls and the interview, I found Anatta Design to be a good match.

Anatta Design is a team of really brilliant engineers focusing on designing custom solutions to e-commerce businesses. They primarily focus on solutions using WordPress and Magento. The company follows a flat hierarchy and a no dress code culture.

Having joined Anatta, I get to choose my own set of tools to work, which I was missing in my previous companies. Going to work in your favorite Tee and trousers/shorts, completely changes the way I work and I absolutely love it. My work is focused on WordPress, PHP and MySQL. The preferred platform of choice is the Linux (Ubuntu distro to be specific) and I’m getting comfortable with it.

Each phase of our lives shapes us to the next one and I’m looking forward to this new phase, of my life.

Adieu Infosys

This October, I’d bid adieu to Infosys to pursue my interest in developing applications with WordPress.

I had been working in Infosys for a little over 2 years. Little did I know about the opportunity to work on WordPress, as a day job, would strike me, I felt that it was the right time to make a move. And, so I did.

The Infosys Journey

I still remember the first day when I entered Infosys headquarters, the office where I worked. Infosys needs no introduction and is the third largest IT services company in India. The place was amazing with head turning buildings, abundant trees, fish ponds, huge food courts and with awesome people around. I was so proud to be part of Infosys and I still do.

Throughout my stint, I’ve been put in different projects and technologies and been with people who are inspiring in one way or the other. I was lucky to an extent, to pursue work on the technologies I loved.

I’ve made couple of friends who filled my heart with joy and I’m always grateful to those folks. I will, forever, cherish those joyous moments.

It was really a tough call, to choose to move out of Infosys, to purse my interest in developing web and WordPress applications. But I believe that I did the right thing. On my last working day, I came out with mixed feelings and long-lasting good memories.

Wait But Why?

Infosys is a great place to work. There is no doubt about it.

Developing web applications with WordPress and PHP is something that I wanted to do, since the beginning of this year as I enjoy doing it. I’ve been playing around with WordPress since my college days. The way these open source communities evolve excites me and I wanted to be part of it.

Also, my perspective on life changed when I started reading books, listening to podcasts and started interacting with inspiring people like Sudar, Saurabh and Nirav. All these broadened my views on life.

Imagine, if you draw a box for every week of your entire life (ie. 52 boxes for a year x 90 years), your life would fit in, on an A4 sheet. Those are your weeks and they’re all you’ve got. Here is a visual representation of the same shown by WaitButWhy.com.

I felt that I should start doing things I enjoy more, as my weekly boxes are checked off. All these made sense to me and I chose to work primarily on WordPress and PHP.

[30 Days] Trading WhatsApp For Reading

I wanted to try something new for the next 30 days. So here I begin.

I have read about and watched Matt Cutt’s talk on Try something new for 30 days. But I haven’t considered doing it until today.

It’s the beginning of September and is a perfect time to try something new. One of the things that I’ve wanted to do, is to start reading books. So I’m gonna try and read couple of books in the next 30 days. I would love to hear from you any good book recommendations in the comments.

Since my days are packed, I’ve decided to trade off/limit the time I spend on WhatsApp and start reading books. So you might not find me active on WhatsApp until the end of September.

Meanwhile, you can track my reading progress on goodreads and you can reach me via Twitter.