forked from corgus/eas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcb_order.php
67 lines (47 loc) · 1.63 KB
/
cb_order.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/*
Template Name: CB Order
*/
if (!empty($_REQUEST['order'])) {
$works = explode(',', $_REQUEST['order']);
_d($works);
foreach ($works as $order => $id) {
delete_post_meta($id, 'cborder');
$result = eas_update_meta($id, 'cborder', $order);
}
exit;
}
?>
<?php get_header(); ?>
<?php roots_content_before(); ?>
<div id="content" class="<?php echo CONTAINER_CLASSES; ?>">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo FULLWIDTH_CLASSES; ?>" role="main">
<?php roots_loop_before(); ?>
<?php get_template_part('loop', 'page'); ?>
<?php roots_loop_after(); ?>
<script type="text/javascript" src="<?php echo trailingslashit(get_bloginfo('siteurl')); ?>js/jquery-ui-1.9.2.custom.js"></script>
<?
$works = eas_cb_show_works();
?><ul id="cbworks"><?php
foreach ($works as $w) {
$p = get_post($w);
$img = eas_artwork_img($w, 'thumbnail');
$src = $img[0];
?><li id="<?php echo $p->ID; ?>"><img src="<?php echo $src; ?>"><?php echo $p->post_title; ?></li><?
}
?></ul><script type="text/javascript">
$('#cbworks').sortable().on('sortupdate', function(e) {
ids = $(this).sortable('toArray');
idStr = ids.join(',');
$.get('',{order: idStr}, function(data) {
console.log(data);
})
});
</script> <?php
?>
</div><!-- /#main -->
<?php roots_main_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
<?php get_footer(); ?>