So, Ajax Load More has a javascript callback when it refreshes, so I tried adding an admin-ajax function to do_action(“wp_enqueue_scripts”), and it seems to be succeeding, but its not doing anything in regards to the missing styles.
here’s the PHP I added:
add_action('wp_ajax_cornerstone_reenqueue_styles', function() {
do_action('wp_enqueue_scripts');
wp_die();
});
add_action('wp_ajax_nopriv_cornerstone_reenqueue_styles', function() {
do_action('wp_enqueue_scripts');
wp_die();
});
function my_ajaxurl_script() {
?>
<script type="text/javascript">
var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
</script>
<?php
}
add_action('wp_head', 'my_ajaxurl_script');
And here’s the javascript I added:
<script type="text/javascript">
window.almOnChange = function(alm){
jQuery.ajax({
url: ajaxurl, // Make sure ajaxurl is properly defined
type: 'POST',
data: {
action: 'cornerstone_reenqueue_styles'
},
success: function(response) {
console.log('Cornerstone styles reloaded');
}
});
}
</script>
You can see it logging success to the console, but the do_action(“wp_enqueue_scripts”) doesn’t seem to be helping with the missing styles.