Skip to content

Instantly share code, notes, and snippets.

@randyhoyt
randyhoyt / returnObjects
Last active August 29, 2015 14:04
Code I use in the Roll20 API to make it easy for players to return lanterns to the supply by dropping them in one of two "return" boxes. See comments for line-by-line explanation.
var locations = {};
// blues // you'll to need to know the id of each object
locations["-JNL9wFJ1utz-benCwRR"] = {left:1715,top:665};
locations["-JNL9AedkClTVq5shQW6"] = {left:1802,top:665};
locations["-JNL99iugvAJkfivJtXX"] = {left:1890,top:665};
locations["-JNL9AIuUfnYkIR5Cr2v"] = {left:1977,top:665};
locations["-JNL98m8z0S7ukGPJx1e"] = {left:2065,top:665};
locations["-JNL97z0KJ-p67PQ_nUy"] = {left:2152,top:665};
locations["-JNL94ZnHe0pAj1OaKUq"] = {left:2240,top:665};
function reorder_orderPosts($orderBy) {
global $wpdb, $pagenow, $wp_query;
$excludedPostTypes = array('attachment', 'revision', 'nav_menu_item');
if (!in_array($wp_query->query['post_type'],$excludedPostTypes)) {
if ($pagenow == 'edit.php')
$orderBy = "{$wpdb->posts}.menu_order ASC, post_date DESC";
}
return $orderBy;
}