public static function handle_shortcode($atts, $content = null, $code = "") { extract(shortcode_atts(array('id' => 'detailbox', 'width' => '0', 'columns' => false, 'class' => '', 'post_types' => false, 'calendarized_only' => '0', 'frontend' => '1', 'container_span' => '6', 'post_id' => ''), $atts)); $frontend = '1' == $frontend ? true : false; if (intval($post_id) > 0) { if ($post = get_post($post_id)) { } else { global $post; } } else { global $post; } $out = ''; if (is_object($post) && property_exists($post, 'ID') && $post->ID > 0) { $s = rhc_post_info_shortcode::get_post_extra_info($post->ID, $id); $container_span = '' == $s->span ? $container_span : $s->span; //specific post content size overwrites the shortcode argument value. if ($calendarized_only == '1') { if ('' == trim(get_post_meta($post->ID, 'fc_start', true))) { return ''; } } if (false !== $post_types) { $arr = explode(',', str_replace(' ', '', $post_types)); if (is_array($arr) && count($arr) > 0) { if (!in_array($post->post_type, $arr)) { return ''; } } } $out = rhc_post_info_shortcode::render($post->ID, intval($width), $class, $columns, $frontend, $container_span, $s); } return $out; }
function wp_ajax_get_postinfo() { foreach (array('post_ID' => 0, 'postinfo_boxes_id' => '') as $field => $default) { ${$field} = isset($_POST[$field]) ? $_POST[$field] : $default; } if (!empty($post_ID) && !empty($postinfo_boxes_id)) { $response = (object) array('R' => 'OK', 'DATA' => rhc_post_info_shortcode::get_post_extra_info($post_ID, $postinfo_boxes_id)); die(json_encode($response)); } else { $response = (object) array('R' => 'ERR', 'MSG' => __('Missing parameter.', 'rhc')); die(json_encode($response)); } }