I created a custom theme for my website and I’m in the process of updating the theme to work with Gutenberg. So far the file size of the theme’s functions.php file is currently 1.9MBs. Does the file size of my theme’s functions.php file matter? If so, then how do I create a custom plugin?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
I guess it doesn’t really matter, but I think it’s better to keep it as short as possible.
Before, I used to put all of my logic in my functions.php file.
But it was quick big at the end (like 2000 lines of code, sometimes more).
Now, I prefer generate a sample theme thanks to this : https://underscores.me/
And for my plugin, that https://wppb.me/
Thanks to this, functions that I usually use in my websites are all in my plugin, so my theme is lighter
Think to seperate all your content logic in files/folder (inc/entities for post_type, inc/cron for your cron… it depends on you !)
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0