WordPress Infinite Scroll without using any plugin

For single article infinite scroll below is the solution single.php <div class=”blog-article-section”> <?php while( have_posts() ): ?> <div class=”blog-article”> <?php if( have_posts() ): the_post(); ?> <h2><?php the_title(); ?></h2> <p><?php the_content(); ?></p> <?php endif; ?> <div class=”pagination-single” > <div class=”next_post_link”><?php previous_post_link( ‘%link’,’Previous Post’ ) ?></div> <div class=”previous_post_link”><?php next_post_link( ‘%link’,’Next Post’ ) ?></div> </div> </div> <?php endwhile; … Read more

Jquery in Child Theme

First off, jquery is most likely already enqueued by the main theme. But if not, the proper way is to call wp_enqueue_script(‘jquery’) in a function for the action hook wp_enqueue_scripts. Example: function enqueue_jquery() { wp_enqueue_script(‘jquery’); } add_action(‘wp_enqueue_scripts’, ‘enqueue_jquery’). This code would need to be added to the functions.php file for your child theme. You would … Read more

Google Maps not displaying in wordpress using Google Maps Javascript API

I was able to get this working after a bit of fiddling. Give the #map-canvas element a height (you can do this in CSS): <div id=”map-canvas” style=”height:500px”></div> Add the callback argument to the google-maps script URL and add the defer and async attributes to the google-maps script tag. Also make custom-scripts a dependency for google-maps: … Read more

How do I include js without register/enqueue?

Yes, you can use get_template_directory_uri to refer to the theme root path. <script type=”text/javascript” src=”https://wordpress.stackexchange.com/questions/244554/<?php echo get_template_directory_uri();?>/js/amplitude/amplitude.js”></script> But prefered way of doing is to use wp_enqueue_script().

Why my browser keeps loading old version of custom JavaScript files in \divi\js? [closed]

First get datetime stamp of your js file’s last modification, and use it as fourth parameter of wp_enqueue_script function: $path=”full path to your script file”); $handle=”your_handle”; $src=”https://wordpress.stackexchange.com/questions/283374/path of the script, relative to the WordPress root directory”; $depts = array(); // dependencies, if any $ver = filemtime($path); $in_footer = false; wp_enqueue_script($handle, $scr, $depts, $ver, $in_footer); If … Read more