Adding CSS and JS files to WordPress

I know that there are some similar questions but those solutions didn’t work for me.

So I have a HTML, two JS and CSS files for one of the WordPress website pages, and I should mention that the code of the map is written using svg.

I’ve copied the HTML code to the editor of the page, and uploaded the CSS and JS files to the theme folder where style.css exists, and in the functions.php file after the first

<?php

I copied this code

add_action(‘wp_enqueue_scripts’, function() {

if (is_page(‘tourist-attraction’) ) {

wp_enqueue_style(‘iran-map-style’, get_template_directory_uri() . ‘/iranmap.css’, array(), null, ‘screen’);
wp_enqueue_script(‘iran-map-script’, get_template_directory_uri() . ‘/iranmap.js’, array(‘jquery’), null);

}

});

I have also uploaded the files and here’s the link: https://ufile.io/6blqv

Read more here:: Adding CSS and JS files to WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *