简体   繁体   中英

Load html and js files in wordpress

I just installed wordpress through docker-compose. Before installation I have 2 files product.html and order.html and a script.js file that is used in these 2 html files.

Now that I have created my site with wordpress, I would like to know how I can add these 2 html files in wordpress and cleanly load my script.js in these files ?

When I looked, I saw that it is necessary to load the script.js by using "wp_enqueue_script" in a "function.php" but what I do not understand where is this "function.php" or I have to create it myself? And if I have to create it myself in which directory I must to place it ?

Thank you in advance !!!

Try to do this.

<script src="http://www.yoursite.any/wp-content/themes/your-theme/js/file.js"></script>

Add this into your footer.

Carate one new template and added your HTML. Try this for creating the template. https://www.cloudways.com/blog/creating-custom-page-template-in-wordpress/

The functions.php is located in the theme directory. You can either create a child theme or create your own custom theme to change the functions.php. If you change the functions.php of an existing theme (like Twenty Nineteen) your changes will be overwritten by the next theme update.

WordPress has extended documentation on how to create your own theme from scratch . Note that this takes up a lot of time but allows the most customization of your site.

You need to create a new directory theme-name under:

wp-content/themes/theme-name

and put the style.css and functions.php file with some basic comments

Take a look on Wordpress Theme Development page to start from scratch.

You can also dig the default Wordpress themes under wp-content/themes directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM