admin管理员组文章数量:1022949
I found a CSS animation snippet on Codepen, and would like to add it in my WordPress site for preloader animation.
I have seen similar question being asked on here , but I couldn't resolve this from the available information there. I want to know:
1) In which location should I add the codepen html code?
2) In which location should I add given CSS?
3) And in which location should I add any required JS to make it work like it happens here?
I found a CSS animation snippet on Codepen, and would like to add it in my WordPress site for preloader animation.
I have seen similar question being asked on here , but I couldn't resolve this from the available information there. I want to know:
1) In which location should I add the codepen html code?
2) In which location should I add given CSS?
3) And in which location should I add any required JS to make it work like it happens here?
Share Improve this question edited Apr 29, 2019 at 7:28 Vishwa 3762 silver badges17 bronze badges asked Apr 28, 2019 at 12:40 Aishwarya DwivediAishwarya Dwivedi 11 bronze badge1 Answer
Reset to default 21) In which location should I add the codepen html code?
If you're using a child theme, then for example, you could copy parent theme header.php
file to your child theme directory and add the required html to that file after <head>
.
If you're developing your own theme, then put the markup wherever you want on.
Or you could also add the markup with an action hook (e.g. wp_footer
or theme specific action hook, if available). This could be added to your theme's functions.php
file or a custom plugin file. Something along these lines,
add_action( 'wp_footer', 'prefix_my_preloader' ); // or other suitable template hook
function prefix_my_preloader() {
?>
<div id="cooking">
<!-- rest of the markup -->
</div>
<?php
}
2) In which location should I add given CSS?
Styles can be added either to your (child) theme's styles.css
file, Customizer's Additional css section (if available, but maybe not the best option), or a custom css file that is located either in your (child) theme or custom plugin directory. Remeber to include the styles if you're using a custom css file.
3) And in which location should I add any required JS to make it work like it happens here
Scripts can be added either to your (child) theme's scripts.js
file or a custom js file that is located either in your (child) theme or custom plugin directory. Remeber to include the scripts if you're using a custom js file.
P.S
You can also add the styles and scripts with custom functions using action hooks as mentioned on the accepted answer for Add CSS animation as Preloader to WordPress. You would then add these functions either to your (child) theme's functions.php
or a custom plugin file.
I found a CSS animation snippet on Codepen, and would like to add it in my WordPress site for preloader animation.
I have seen similar question being asked on here , but I couldn't resolve this from the available information there. I want to know:
1) In which location should I add the codepen html code?
2) In which location should I add given CSS?
3) And in which location should I add any required JS to make it work like it happens here?
I found a CSS animation snippet on Codepen, and would like to add it in my WordPress site for preloader animation.
I have seen similar question being asked on here , but I couldn't resolve this from the available information there. I want to know:
1) In which location should I add the codepen html code?
2) In which location should I add given CSS?
3) And in which location should I add any required JS to make it work like it happens here?
Share Improve this question edited Apr 29, 2019 at 7:28 Vishwa 3762 silver badges17 bronze badges asked Apr 28, 2019 at 12:40 Aishwarya DwivediAishwarya Dwivedi 11 bronze badge1 Answer
Reset to default 21) In which location should I add the codepen html code?
If you're using a child theme, then for example, you could copy parent theme header.php
file to your child theme directory and add the required html to that file after <head>
.
If you're developing your own theme, then put the markup wherever you want on.
Or you could also add the markup with an action hook (e.g. wp_footer
or theme specific action hook, if available). This could be added to your theme's functions.php
file or a custom plugin file. Something along these lines,
add_action( 'wp_footer', 'prefix_my_preloader' ); // or other suitable template hook
function prefix_my_preloader() {
?>
<div id="cooking">
<!-- rest of the markup -->
</div>
<?php
}
2) In which location should I add given CSS?
Styles can be added either to your (child) theme's styles.css
file, Customizer's Additional css section (if available, but maybe not the best option), or a custom css file that is located either in your (child) theme or custom plugin directory. Remeber to include the styles if you're using a custom css file.
3) And in which location should I add any required JS to make it work like it happens here
Scripts can be added either to your (child) theme's scripts.js
file or a custom js file that is located either in your (child) theme or custom plugin directory. Remeber to include the scripts if you're using a custom js file.
P.S
You can also add the styles and scripts with custom functions using action hooks as mentioned on the accepted answer for Add CSS animation as Preloader to WordPress. You would then add these functions either to your (child) theme's functions.php
or a custom plugin file.
本文标签: phpAdd Codepen animation as Preloader to WordPress
版权声明:本文标题:php - Add Codepen animation as Preloader to WordPress 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745542520a2155247.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论