问题
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