Вопрос

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?

Это было полезно?

Решение

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 !)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с wordpress.stackexchange
scroll top