在Wordpress中加载更多帖子Ajax按钮-修复 [英] Load More Posts Ajax Button in Wordpress - fix

查看:158
本文介绍了在Wordpress中加载更多帖子Ajax按钮-修复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此页面中,作者@dingo_d我发现其中一个最好的选择,用ajax加载更多帖子.但我认为有一个问题.非常感谢作者或其他人可以帮助我...

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...

这部分代码不起作用,我不确定这是仅对我来说还是该代码根本不起作用..因此在function.js中,我们有这个

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

并在加载后发布此

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

在function.php中,我们有这个

in function.php we have this

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

和其他所有东西都起作用,只是这个变量'ppp'不起作用..它总是使用function.php中的这个数字'3'..如果我在function.js中写了例如数字'5',它仍然会显示3帖子.我创建了完全相同的文件,查询等.并且一切正常,只有此var $ ppp无法正常工作……您能帮我看看他的代码有什么问题吗?谢谢

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

推荐答案

代替

 '&ppp' + ppp 

 '&ppp=' + ppp 

这篇关于在Wordpress中加载更多帖子Ajax按钮-修复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆