Dynamically loading posts with Wordpress

半腔热情 提交于 2019-12-08 09:50:56

问题


This helpful idea from Andy Gaskell supports 50% of my next question:

I'd like to load posts dynamically with WordPress. Fetching them with Andy's function does work, but How do I bind the load to each and every one of the posts?

Can I insert PHP generated content (post permalink, for example) to the JS script?

Thank you.


回答1:


Got it:

$("#triggerDIV a").click(function(id){
    event.preventDefault(); // prevent a element from executing
    var id = this.getAttribute('href'); // get the link
    $("#targetDIV").load(id); // load it
});



回答2:


Maybe Jquery and Ajax in Wordpress Plugins?



来源:https://stackoverflow.com/questions/1356861/dynamically-loading-posts-with-wordpress

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