Monthly Archives

October 2016

How to do Ajax in WordPress

By | Ajax, Javascript, Web Design, Wordpress | No Comments

updated 10th Jan 2018

Write a javascript function to trigger the ajax call

Put js above in my_js_file.js (see later in this post).

Wrap in code below for nice loading:

jQuery( document ).ready(function() {    put above code here     });

To see how to send a form via ajax see here.

 

Write a php function to handle the ajax call (you could put this in functions.php)

 

There is one final piece, you might notice the ajax_object.ajax_url in the Javascript function above. We need to make this available in the js file that this function is in. This needs to be done in php.

Include ajax_url like this (below)

 

Handy Woocommerce SQL queries

By | PHP, SQL, Woocommerce | 2 Comments

This post is just a place to store handy SQL queries for Woocommerce.

Get Order and all its information

 

Get Users and billing and shipping addresses in Woocommerce

this bit of sql is based on this post at http://codecharismatic.com/

Get Order Objects (not strictly sql, but seems a good place to drop it)