Sorting a list of posts displayed under a list of associated terms (which should be sorted without initial articles)

This is a really interesting question, which can result in a very expensive, resource intensive process which can really slow your page down dramatically PRELUDE All my code in this question is based on the following post type and taxonomy, so before you run any code, make sure to adjust the post type and taxonomy … Read more

Post queries by latitude and longitude

Close. You need another INNER JOIN and should escape all your variables using $wpdb->prepare. I’ve also included a more efficient Haversine formula (source) to calculate the radius. If you use kilometers, then change the $earth_radius to 6371. Also, a great way to debug is to echo the sql and paste it into phpMyAdmin (or whatever … Read more

WP_query ‘orderby=none’ Problem

You can order them manually after the query is complete: $ids = array (60, 23, 78, 46, 105, 130) $args = array ( ‘posts_per_page’ => -1, ‘post__in’ => $ids, ‘orderby’ => ‘none’ ); $query = new WP_Query ( $args ); $ordered_posts = array(); foreach($ids as $rpid) foreach($query->posts as $index => $fpid) if($fpid->ID === $rpid) $ordered_posts[] … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)