jQuery(document).ready(function($){$('.filter-tabs a').click(function(event){event.preventDefault();$('.filter-tabs a').removeClass('active');$(this).addClass('active');$("#show_posts").html('Please wait....')
$.ajax({url:my_ajax_object.ajaxurl,type:'POST',data:{action:'get_posts_by_subcat_ajax',slug:$(this).data('slug')},success:function(response){console.log(response);$("#show_posts").html(response)},error:function(xhr,status,error){}});});var page=2;$('#load-more').on('click',function(){var button=$(this);$.ajax({url:my_ajax_object.ajaxurl,type:'POST',data:{action:'load_more_posts',page:page,},beforeSend:function(){button.text('Loading...');},success:function(response){if(response){$('#post-container').append(response);button.text('Load More');page++;}else{button.text('No More Posts');button.prop('disabled',true);}}});});$('.pagination a').on('click',function(e){if($('#post-container').length>0){e.preventDefault();var page=$(this).attr('data-page');var cat=$(this).attr('data-cat');$.ajax({url:my_ajax_object.ajaxurl,type:'post',data:{action:'load_posts_by_ajax',page:page,category:cat},beforeSend:function(){$('#post-container').html('Loading...');},success:function(response){$('#post-container').html(response);$('.pagination a').removeClass('active');$('.pagination a[data-page="'+page+'"]').addClass('active');$('html, body').animate({scrollTop:$('body #latest').offset().top},800);}});}});$(document).on('click','.pagination_tabs a',function(e){e.preventDefault();var page=$(this).attr('data-page');var cat=$(this).attr('data-cat');$.ajax({url:my_ajax_object.ajaxurl,type:'post',data:{action:'load_tab_posts_by_ajax',page:page,slug:cat},beforeSend:function(){$('#show_posts').html('Loading...');},success:function(response){$('#show_posts').html(response);$('.pagination_tabs a').removeClass('active');$('.pagination_tabs a[data-page="'+page+'"]').addClass('active');$('html, body').animate({scrollTop:$('body #show_posts').offset().top},800);}});});$('a[data-toggle="pill"]').on('click',function(e){history.replaceState(null,null,' ');});});