extract database query into templates
-
Hi,
I want to run a query inside my woocommerce templates on the backend.This will return the proper value if I do the following . . .
<?php global $wpdb; $wc = $wpdb->get_var( " SELECT meta_value FROM wp_postmeta WHERE post_id = 128 AND meta_key = '_mycustomfield' " ); echo $wc; ?>
I’m inside the woocommerce thankyou.php template at the moment and I want to filter not on post_id=128 but something along the lines of post_id=$order->post_id.
I just can’t get the syntax for this type of query. How do I specify the current order?
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘extract database query into templates’ is closed to new replies.