Mon, Jan 13, 2025
comments powered by Disqus
Your First WP Theme's functions.php
Building a WordPress theme is getting easier nowadays as WP developers provided a tool called “Create Block Theme.” The tool can generate a starter block theme easily that you can improve then.
Even if you can use the tool to generate a starter theme, you should provide your functions.php file yourself because the tool does not provide the file by default. Due to it being very necessary, such as linking the theme to the CSS, you should provide it in your theme folder. Below is the simple code. Put the code as functions.php in your root theme.
<?php
function your_theme (){
wp_enqueue_style( 'style', get_stylesheet_uri() );
};
add_action('wp_enqueue_scripts', 'your_theme');