Integrate OpenStreetMap on WordPress

Ok so I finally managed to get it working, my map now displays, thanks to you people. What I did is : I changed the path to the absolute path of the scripts. Indeed, using a relative URL was a bad idea. I have changed my script, which now looks like that : document.addEventListener(“DOMContentLoaded”, function() … Read more

How does wp_enqueue_scripts work?

Thanks for rewriting the question: It seems much clearer now. Sorry for the protracted comments earlier, but I wasnt on my laptop. I corrected a couple of typos in your code and pasted this into my functions.php: // include files via shortcode function include_file($atts) { extract(shortcode_atts(array(‘filepath’ => NULL), $atts)); if ($filepath!=’NULL’ && file_exists( trailingslashit( get_stylesheet_directory() … Read more

How to add if lt IE9 conditional scripts to functions.php

Yes, that looks broadly correct (barring a missing ‘). That isn’t a jQuery $, so shouldn’t cause any problems – the dollar prefix here is the usual convention for PHP variable names and won’t make it into the included script. Or if I’ve misunderstood and you meant your ie.js script assumes jQuery is $ then … Read more

Overwriting the menu break points of twentysixteen in child theme

Copy the js folder of the parent TwentySixteen theme to child theme root. Then add the below code in your functions.php– function the_dramatist_dequeue_scripts() { wp_dequeue_script( ‘twentysixteen-script’ ); wp_deregister_script( ‘twentysixteen-script’ ); } add_action( ‘wp_print_scripts’, ‘the_dramatist_dequeue_scripts’ ); function the_dramatist_twentysixteen_scripts() { wp_enqueue_script( ‘twentysixteen-child-script’, get_stylesheet_directory_uri() . ‘/js/functions.js’, array( ‘jquery’ ), null, true ); } add_action( ‘wp_enqueue_scripts’, ‘the_dramatist_twentysixteen_scripts’ ); Then … Read more

How to insert HTML/JavaScript form into WordPress page? [closed]

You have a bunch of issues: 1. WordPress part: Your function is hooked to wp_enqueue_scripts and should be like this: function wpse238953_calculate() { wp_enqueue_script(‘calculate’, plugins_url(‘/js/calculate.js’), __FILE__), array(‘jquery’), false); } add_action(‘wp_enqueue_scripts’, ‘wpse238953_calculate’); Note the different spellings between wp_enqueue_scripts and wp_enqueue_script 2. The HTML/JS part: Let’s add some id to the two input fields so that it’s … Read more