Callback functions NOT firing?
-
I currently have the latest (2.12.0) version of this plugin. I am currently testing these callback functions (almDone and almEmpty) on a Chrome browser and the desired console messages does not log for both when conditions are true. In a separate JS file, I have the following code.
(function ($) { //1. almDone $.fn.almDone = function(alm){ console.log('All posts have been loaded!'); }; //2. almEmpty $.fn.almEmpty = function(alm){ console.log('Sorry, but we could not locate any posts that matched your criteria.'); }; })(jQuery);I also made sure that the file is loaded after the Ajax Load More plugin JS file. Here is a snippet code from my functions.php file.
add_action( 'wp_enqueue_scripts', 'site_assets'); function site_assets() { ... wp_register_script( 'ajax-load-more', plugins_url() . '/ajax-load-more/core/js/ajax load-more.min.js', array( 'jquery' ), '2.12.0', true ); ... wp_register_script( 'ajax-load-more-callback', get_template_directory_uri() . '/js/ajax-load-more-callback.js', array( 'jquery', 'ajax-load-more' ), null, true ); ... if ( ( is_home() || is_post_type_archive ( array( 'web_design', 'other_works' ) ) ) || is_tag() ) { ... wp_enqueue_script( 'ajax-load-more-callback' ); }
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Callback functions NOT firing?’ is closed to new replies.