/** * 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 = getThemeRexCalendar(true, 0, 0, array('post_type' => $post_type)); if (!empty($output)) { /* Before widget (defined by themes). */ echo balanceTags($before_widget); /* Display the widget title if one was input (before and after defined by themes). */ echo balanceTags($before_title) . esc_html($title) . balanceTags($after_title); echo balanceTags($output); /* After widget (defined by themes). */ echo balanceTags($after_widget); } }
function themerex_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' => getThemeRexCalendar(true, $m, $y, array('post_type' => $pt))); echo json_encode($response); die; }