-
-
Save raiden808/cbee1ad87ce668e225b6fe7555956e79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('wp_head',function(){ | |
?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function( $ ) { | |
var ajaxUrl = "<?php echo admin_url('admin-ajax.php')?>"; | |
var page = 1; // What page we are on. | |
var ppp = 3; // Post per page | |
$("#more_posts").on("click",function(e){ // When btn is pressed. | |
e.preventDefault(); | |
$("#more_posts").attr("disabled",true); // Disable the button, temp. | |
$.post(ajaxUrl, { | |
action:"more_post_ajax", | |
offset: (page * ppp) + 1, | |
ppp: ppp | |
}).success(function(posts){ | |
page++; | |
$(".blog_wrapper").append(posts); // CHANGE THIS! | |
$("#more_posts").attr("disabled",false); | |
}); | |
}); | |
}); | |
</script> | |
<?php | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment