How to get rid of common WordPress Themes errors

How to get rid of common WordPress Themes errors

admin, January 9, 2019

Are you thinking of developing Free or Premium WordPress Themes? I can assist you to get rid of some common errors that I have come across over the years. I always go for a clean coding but still make mistakes while developing a theme, no matter how careful I am. This article will surely help you in avoiding these mistakes.

1. Don’t complicate the code

Always be careful while creating a nice looking theme, especially when you create a function which is similar to other functions which are available. For example, I was working on a function “get_portfolio_part($name, $slug). I created this function in order to save myself from writing boring and tiresome code, which is “get_template_part(“portfolio/$name”, $slug);”. This is what complicates the code which you are trying to use. Both codes are doing the same thing but in order to save those few keystrokes, it was hard to make out where that function is fetching files from.

I don’t know what came into my mind for making get_portfolio_part() function in my stupid head. What if I had to move the portfolio directory years later? Now comes the mistake no. #2.

2. Don’t anticipate the future

Sometimes we are pathetic in anticipating the future. Still, as a good developer, we always aim to do this most of the times.

For example, suppose you have created an option to show social icons in one of your posts. Forget, whether you are going for a plugin or using any other method to do this. Just think that this is what you are doing. So, this is the function that we will go for:

Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.

Copyright
Online Payment
paypal-image
Follow Us