How to implement AJAX post navigation into WordPress?

What you are looking for is AJAX navigation. It’s not that complicated, however it’s not very easy too. I’ve written a simple example for you, I hope it helps you in your case. An AJAX request has 2 steps, first a front-end request that is sent out by browser when for example a user clicks … Read more

Ajax template: how to handle head section

Ok, you want that mobile devices always load mobile templates. Desktop devices load template files based on resolution: if < 1080 mobile ones, > 1080 desktop ones. Your workflow should be: On init you check for mobile devices using wp_is_mobile. If true you add a template filter that returns str_replace(‘.php’, ‘-mobile.php’, $template); where $template is … Read more

How is it possible that the function of the test page works, but it does not go live?

Try changing your script to this since you’re not actually running a cross-browser request: <script> (function($) { $(document).ready(function() { var refreshId = setInterval(function() { $(‘#content’).fadeOut(“fast”).load(‘/new.php’).fadeIn(“fast”); $(“#content .span9 article”).unwrap(); }, 10000); }); })(jQuery); UPDATE: Wrapped in WP-friendly jQuery no-conflict code…

AJAX Call Via Vanilla JavaScript In WordPress Plugin Development

Thanks Muhammad, Your solution is a fantastic working framework on which to base real world AJAX calls. I just added this code to the plugin main php file for a shortcode so I could use it in the Front End too. //For front end use in production add_shortcode(‘wp_testingPlugin_shortcode’, ‘wp_testingPlugin_shortcode’); function wp_testingPlugin_shortcode() { wp_enqueue_script( ‘ajax-script’, plugin_dir_url( … Read more

Automatically pull newer posts and append to current page.

I was in the same situation as you recently. The way I did it is probably wrong, and prone to bugs but if you can live with that then this might help. Basically you create an empty array at the top of your loop file, say for example loop-index.php. $ignores = array(); Then inside your … Read more