Archived topic
Modify Theme to speed up Youtube Videos
1 reply · Started by Martin on March 7, 2020
Hi there,
I want to implement this to my theme to improve my sitespeed when embedding Youtube Videos:
Basically I would need to know:
1. How and where to place some JavaScript the theme’s .js file
2. How and where to some CSS in your theme’s style.css
Best regards from Germany
Martin
Hi there,
you don't make edits / changes or add to the Themes files, as they will be overwritten when the Theme is updated.
Instead you could use a Child Theme:
https://docs.generatepress.com/article/using-child-theme/
The styles.css is where you would add your CSS files.
Alternatively you can add the CSS to Customizer > Additional CSS
For the JS - simplest method would be to add it using a Hook Element.
https://docs.generatepress.com/article/hooks-element-overview/
Add your script inside <script> tags ie
<script>
// Add the JS here //
</script>
Then select the WP_footer hook, and set your Display Rules accordingly.