Site logo

Archived topic

Additional CSS files and Javascript files

1 reply · Started by shlomo on January 12, 2023

Viewing posts 1–2 of 2

We have a few CSS files, JavaScript files, and JavaScript we want to add.
Until now we added it in the header.php and footer.php.
But when we update the theme we need to put it again in the new theme updates.

Where is the right place to put it without us keeping it added over and over again during the update?

Hi Shlomo,

You can add the CSS through Appearance > Customize > Additional CSS.

As for the JS code, you can add them through a Hook Element hooked to wp_head or wp_footer. Reference: https://docs.generatepress.com/article/hooks-element-overview/

As for files, you'll need to use a Child theme and enqueue theme. Reference: https://docs.generatepress.com/article/using-child-theme/
This thread may be helpful as well: https://generatepress.com/forums/topic/enqueue-styles/

This archived topic is closed to new replies.