SELECT post_id, SUM(dl)
FROM wp_day_download
WHERE date>=DATE_ADD(CURRENT_TIMESTAMP,INTERVAL -7 DAY)
AND post_id IN (
SELECT object_id
FROM wp_term_relationships
WHERE term_taxonomy_id = (
SELECT term_taxonomy_id
FROM wp_term_taxonomy
WHERE term_id = 179 )
)
GROUP BY post_id
<?php
add_action('post_submitbox_misc_actions','post_check_box');
function post_check_box() { ?>
<div class="misc-pub-section">
<p><input type="checkbox" name="post_to_vk" /> Опубликовать на стене ВКонтакте </p>
</div>
<?php } ?>
if (($new_status == 'publish' && $old_status != 'publish') || ( isset( $_POST['post_to_vk'] ) && $_POST['post_to_vk'] && $new_status == 'publish' )) {
cross_post($post);
}