/** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : ''); $post_type = isset($instance['post_type']) ? $instance['post_type'] : 'post'; $output = axiom_get_calendar(false, 0, 0, array('post_type' => $post_type)); if (!empty($output)) { /* Before widget (defined by themes). */ echo $before_widget; /* Display the widget title if one was input (before and after defined by themes). */ echo $before_title . $title . $after_title; echo $output; /* After widget (defined by themes). */ echo $after_widget; } }
function axiom_callback_calendar_change_month() { global $_REQUEST; if (!wp_verify_nonce($_REQUEST['nonce'], 'ajax_nonce')) { die; } $m = (int) $_REQUEST['month']; $y = (int) $_REQUEST['year']; $pt = $_REQUEST['post_type']; $response = array('error' => '', 'data' => axiom_get_calendar(false, $m, $y, array('post_type' => $pt))); echo json_encode($response); die; }