So after a time learning and practicing, I realized there are some ways to get rid of multi-layered if-else nested conditions.
code refactoring
WordPress: How to make the functions.php less messy
I have been working with WordPress for a while and one thing that irritates me is that the functions.php contains a lot of codes. This makes the file looks messy and hard to follow. Check out from here some methods to improve this.
Code refactoring: When and How
In general, code refactoring refers to the process of changing bad codes into cleaner, purposeful, human-readable, reusable code in order to be cost effective, easy to maintain and collaborate, and probably a better performance.