Load More Posts Ajax Button in Wordpress - fix

2019-05-28 23:17发布

On this page from author @dingo_d I found one of the best option to load more post with ajax. but I think there is one issues. I really appreciate if author or somebody else can help me...

This part of code not work, I am not sure is this just for me or this code not work at all .. so in function.js we have this

var ppp = 3; // Post per page

and in load post this

var str = '&cat=' + cat + '&pageNumber=' + pageNumber + '&ppp' + ppp + '&action=more_post_ajax';

in function.php we have this

$ppp = (isset($_POST["ppp"])) ? $_POST["ppp"] : 3;

and everything else work just this variable 'ppp' not working .. its always use this number '3' from function.php .. and if I wrote for example number '5' in function.js its still will show 3 posts . I create exactly same files, queries and etc.. and everything work great, only this var $ppp its not work... can you please help me to see what is wrong with his code? Thanks

1条回答
虎瘦雄心在
2楼-- · 2019-05-29 00:20

instead

 '&ppp' + ppp 

do

 '&ppp=' + ppp 
查看更多
登录 后发表回答