Ajax and wordpress

Out of context: Reply #6

  • Started
  • Last post
  • 16 Responses
  • acescence0

    create a php file and paste this in it:

    http://pastebin.com/iWkdmfaH

    be sure to change the path to your location of wp-load.php relative to where you put this file, you can also change all the loop stuff to format it however you'd like.

    call this file in your ajax function and pass the post id. you might need to change $_GET to $_POST, depending on which your ajax function is using. also, if you're using another var other than "postid", change that as well.

    then in your handler that processes the ajax response, overwrite the html in your post display area with the response text, or do whatever fancy animation you'd like, etc..

    • you can also use this method to pull wordpress posts outside of a wordpress siteacescence

View thread