Load More Posts Ajax Button in Wordpress - fix

早过忘川 提交于 2019-12-09 22:42:03

问题


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:


instead

 '&ppp' + ppp 

do

 '&ppp=' + ppp 


来源:https://stackoverflow.com/questions/35629203/load-more-posts-ajax-button-in-wordpress-fix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!