• I cannot figure out how to edit the <head> tag in the twenty twenty-three theme. Every tutorial or guide I have looked at tells me to edit the header.php file in the theme, however the twenty twenty-three theme only has a header.html and does not contain the <head> tag. How would I go about adding a CSS <link> tag into the <head> tag of this theme? It also appears that there are a lot of missing files that these guides have but this theme does not, mainly the *.php files.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @rpgrogan the TT3 theme is different from the previous default themes, it is a block-based theme that allows for Full Site Editing. This means you no longer need custom code to change how certain sections look on your theme. The file structure is also different, may I ask why you want to edit the header file?

    There might be a different way to achieve that. Additionally, the resources below might help figure out how to use the theme and how it is structured:

    • This article explains the TT3 theme and how to use it.
    • The theme uses Full Site Editing, which is explained in detail in this article.
    Thread Starter rpgrogan

    (@rpgrogan)

    @thelmachido I want to add Bootstrap 5 styles to the theme so that I can use the style classes. Is there a way to add bootstrap style sheets to the theme?

    Moderator Kathryn Presner

    (@zoonini)

    Hi there @rpgrogan, developer @greenshady shared that the correct method to do this would be to use wp_enqueue_style() This would be the same for both block themes (like Twenty Twenty-Three) and classic themes, and you can learn more about the function here.

    As Justin says, “There are several examples on that docs page, including using a CDN. For example, this should go into the theme’s functions.php (preferably a child theme):”

    add_action( 'wp_enqueue_scripts', 'my_theme_styles' );
    
    function my_theme_styles() {
      wp_enqueue_style( 'style-name', 'url/to/css-file.css' );
    }

    You might like to use the Create Block theme plugin to make your child theme of a block theme. (Don’t edit the TT3 theme files directly, otherwise you’ll lose all your changes every time the theme is updated.)

    Let us know how it goes.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘No file ‘header.php’’ is closed to new replies.