/** * themeple_media::get_custom_post() * * @return */ public static function get_custom_post($post_title) { $save_title = themeple_admin_safe_string($post_title); $args = array('post_type' => 'themeple_fw_post', 'post_title' => 'themeple_' . $save_title, 'post_status' => 'draft', 'comment_status' => 'closed', 'ping_status' => 'closed'); $post = themeple_media::get_post_by_title($args['post_title']); if (!isset($post['ID'])) { $post_id = wp_insert_post($args); } else { $post_id = $post['ID']; } return $post_id; }
/** * themeple_viewgen::upload() * * @param mixed $element * @return */ function upload($element) { $postId = themeple_media::get_custom_post($element['name']); $output = ''; $output .= '<input type="text" class="semi_input themeple_upload_input" name="' . $element['id'] . '" id="' . $element['id'] . '" value="' . (isset($element['std']) ? $element['std'] : '') . '" />'; $output .= '<a href="#' . $postId . '" title="' . $element['name'] . '" class="mrgleft themeple_btn themeple_btn_active themeple_upload">' . $element['btn_text'] . '</a>'; $output .= '<div class="image_prev">'; $output .= '<img src="' . (isset($element['std']) ? $element['std'] : '') . '" alt="' . $element['name'] . '" />'; $output .= '</div>'; return $output; }