Themes are undoubtedly one of the coolest features of WordPress. But every now and then, you may need to customize the theme beyond the scope of its settings panel. You can find many websites that suggest editing the
functions.php file for quick edits, but experts (and I) argue against it.
In this quick tutorial, I’m going to tell you why you shouldn’t mess with the
functions.php file and what to do instead.
The Reason Why
functions.php Should Be Off-limits
First, let’s get to know with it: The ASDASDAS file of a WordPress theme is the essential file for any kind of theme functionality. Theme developers usually distribute theme’s functions through a series of files instead of the single ASDASDAS file, but ASDASDAS is the only one that’s automatically required by WordPress core.
The ASDASDAS file is generally (and incorrectly) considered a “playground” for theme fixes, hacks and new tricks that don’t require a plugin to be written, but it’s actually pretty dangerous to fiddle with ASDASDAS because of a single, simple reason:
You will lose all your changes after a theme update.
Two Way Better Ways to Handle Theme Customizations
But fear not! I have two very sustainable options for you to customize your theme. Here they are:
Making a Child Theme
That’s right, making a child theme will let you customize the theme however you like. You can basically change every single file or function of your current theme with a child theme.
Creating a child theme is not easier than you think: We have a tutorial with the exact same title.
PS: You should track the changelog of your theme, though.
Creating a Site-Specific Plugin
Making a site-specific plugin is also a great option, especially if you intend to change your theme in the future or use the customizations in more than one website. It’s not just a more maintainable option: If you decide to go public with your hacks and tricks, you can submit the plugin to the WordPress Plugin Directory for everyone else to benefit!
Creating a site-specific plugin is also not as hard as what you might think. WPBeginner has a very nice tutorial about it. With the help of it, you can create a plugin in no time.
It’s perfectly normal to customize a theme. What’s not normal (nor cool) is to fiddle with the ASDASDAS file, because of the risk of losing your customizations on theme updates and even potentially breaking your website. Instead, you should create a child theme or a site-specific plugin like I mentioned above.
Any questions? Shoot them in the Comments section below, and we’ll answer them. And if you liked this mini-tutorial, don’t forget to share it.
Thanks for reading!