Proper way of minifiying java script files in wordpress theme

Ad1. Just after make minification, do some tests with development tools (F12 in FF) There is a console where you will see all errors, warning etc. If something went wrong, you’ll see it https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Opening_the_Web_Console Ad2. Hard to say because every case is different but sometimes it’s matter. Which plugin do you use for that? For … Read more

Landing function through URL

You have a few options. GET Parameter The easiest one is to add a GET parameter to the url of the links, so you call it like this: domain.com/page?function=1 Then, on your page page, you can access this parameter using global array $_GET[‘function’] and do your logic as you wish. POST Parameter – wrap into … Read more

Can I just insert JavaScript by using ?

Note: you should use child theme ( here I’ll reference main theme ) I believe you’ve downloaded that jsbat.js file somewhere in your wordpress root directory consider this your root directory of web /xampp/htdocs/wordpress_site/wp-content/themes/theme-name/assets/js/jsbat.js now you’ll need to find functions.php file in your theme. Typically this resides in this folder: /xampp/htdocs/wordpress_site/wp-content/themes/theme-name/functions.php edit functions.php file, and … Read more

How can javascript be added to a custom-page.php template?

Save your JS in a seperate file and use a Conditional to Enqueue it. Something like this will work. function my_enqueue_stuff() { if (is_page_template(‘custom-page.php’)) { wp_enqueue_script( ‘my-functions’, get_stylesheet_directory_uri() . ‘/my-functions.js’, array(‘jquery’), filemtime(get_stylesheet_directory() . ‘/my-functions.js’) ); } } add_action( ‘wp_enqueue_scripts’, ‘my_enqueue_stuff’ ); The above will go in your Child Theme’s functions.php file.

Post title and url not showing on google map marker [closed]

I have solved it by doing it like this. function myMap() { var gmarkers = []; var markers = []; var infowindow = new google.maps.InfoWindow({ content: ” }); var myCenter = new google.maps.LatLng(44.794426, 20.451849); var mapProp = {center:myCenter, zoom:15, scrollwheel:false, draggable:true, mapTypeId:google.maps.MapTypeId.ROADMAP}; var map = new google.maps.Map(document.getElementById(“googleMap”),mapProp); var myJsarray = passed_object.retrieve_data; var latitute=”” ; var … Read more