While creating a custom theme using Twenty Twenty-Three WordPress default theme.
I face major changes in the theme as compared to the old theme there are no functions.php files. The whole structure of the theme is changed.I found theme.json files, you can check the structure below in the screenshot
Then again inside the parts folder i found header & footer code pls check below:
<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group">
<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"bottom":"var:preset|spacing|40"}}},"layout":{"type":"flex","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide" style="padding-bottom:var(--wp--preset--spacing--40)">
<!-- wp:site-title {"level":0} /-->
<!-- wp:navigation {"layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"right"}} /-->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->
So my question is can we create a functions.php file and add the scripts, style, and other hooks or should we still use the old theme to create a custom Theme WordPress?
2
Answers
Definitely yes! I’ve created a Twenty-Twenty-Three child theme and added my own function.php and style.css to it – works perfectly.
Like @Vadim H, I have also created both a Twenty-Twenty-Three child theme and a standalone FSE theme. I added functions.php to both. WordPress should automatically find the file when it is at the theme root (as shown in my screenshot). See the Developer Resources here.
FWIW: I also added some script to the Twenty-Twenty-Three child theme "assets" folder. Here is what my themes looks like, including functions.php
The Child Theme Configurator can be helpful when starting out with FSE child theme.