• Resolved Gin

    (@rawdolphe)


    I have installed the plugin ‘Create Block Theme’ to create a child theme for Twenty Twenty-Four.

    All went well, but to my surprise it did not generate the functions.php file.

    I believe the functions.php should have some enqueue script related to the theme to work efficiently?

    I do use Code Snippet as well…

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Gin

    (@rawdolphe)

    The following post is very helpful: https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/

    But would rather hear from the developers to do it right.

    Moderator jordesign

    (@jordesign)

    Hi @rawdolphe,

    One reason for that is that Block Themes (like Twenty Twenty-Four) do not need, or use, functions.php – so even generating a copy with Create Block Theme won’t add one.

    That being said – you can manually add a functions.php file to the child theme if you want to. But with Block Themes – my recommendation would usually be to use a Code Snippet plugin like you mentioned.

    Thread Starter Gin

    (@rawdolphe)

    Hi @jordesign,

    Thank you for your reply and input—duly noted.

    https://developer.www.ads-software.com/themes/basics/theme-functions/ “Functions.php can be used by both classic themes, block themes, and child themes…..The same result can be produced using either a plugin or functions.php. If you are creating new features that should be available no matter what the website looks like, it is best practice to put them in a plugin. If the code is within the functions.php it applies only to that theme” I thought something had changed with block themes given your comment. I left WP for years and have just returned. Am accustomed to using functions, styles..etc in child themes so I my eyebrows raised when I read your words.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Functions.php in Child theme’ is closed to new replies.