M.Javad 684 ارسال شده در اسفند 93 گزارش بازنشر ارسال شده در اسفند 93 سلام چطوری فرم آپلود عکس برای تصویر شاخص رو در افزونه ارسال نوشته مهمان اضافه کنم؟!فایل ارسالfunction wp_posts_sender() { if(!session_id()) { echo '<div style="display:none;">'; session_start(); echo '</div>'; } include ("form.php"); global $current_user; if($_POST['secCode'] != $_SESSION['secCode']) { $step['capcha'] = false; } else { $_SESSION['secCode'] = rand(100000, 999999); $step['capcha'] = true; } if($_POST['name_author']){ $step['auhtor'] = true; } if($_POST['email_auhtor']){ $step['email'] = true; } if($_POST['site_author']){ $step['site'] = true; } if($_POST['post_name']){ $step['title'] = true; } if($_POST['post_content']){ $step['content'] = true; } if(isset($_POST['send_post'])) { if( ($step['capcha'] && $step['title'] && $step['content']) == true ) { $all_separator = array (",", ".", ",", "+", "-", "_", " ", "،"); $standars_separator = array (",", ",", ",", ",", ",", ",", ",", ","); $final_tags = str_replace ($all_separator, $standars_separator, $_POST['post_tags']); if(is_user_logged_in()) { $get_userid = $current_user->ID; } else { $get_userid = "1"; } $new_post = array( 'ID' => '', 'post_author' => $get_userid, 'post_category' => array($_POST['cat']), 'post_content' => $_POST['post_content'], 'post_title' => $_POST['post_name'], 'tags_input' => $final_tags, 'post_status' => get_option('type_publish') ); $post_id = wp_insert_post($new_post); if($_POST['name_author'] && $_POST['email_auhtor'] && $_POST['site_author']) { add_post_meta($post_id, "name", $_POST['name_author']); add_post_meta($post_id, "email", $_POST['email_auhtor']); add_post_meta($post_id, "site", $_POST['site_author']); } for($i = 1; $i <= get_option('sum_custom_field'); $i++) { $cfn[$i] = $_POST["cn_$i"]; $cfv[$i] = $_POST["cv_$i"]; add_post_meta($post_id, $cfn[$i], $cfv[$i]); } echo "<p class='publish'>نوشته انتشار شد.</p>";فایل فرم <div id="form"><form method="post" action=""> <table> <?php if(!is_user_logged_in()) { ?> <tr> <td id="lable"><label for="post_name">نام شما</label></td> <td><input type="text" name="name_author" class="post_input" id="name_author"/></td> </tr> <tr> <td id="lable"><label for="post_name">شماره تماس</label></td> <td><input type="text" name="email_auhtor" class="post_input" id="email_auhtor"/></td> </tr> <tr> <td id="lable"><label for="post_name">منطقه</label></td> <td><input type="text" name="site_author" class="post_input" id="site_author"/></td> </tr> <?php } ?> <tr> <td id="lable"><label for="post_name">نام آگهی</label></td> <td><input type="text" name="post_name" class="post_input" id="post_name"/> *</td> </tr> <tr> <td><label for="post_content">توضیحات آگهی</label></td> <td><textarea name="post_content" class="post_input" id="post_content"/></textarea> *</td> </tr> <tr> <td><label for="post_category">دسته بندي</label></td> <?php $get_cat_id = get_option('cat_id'); ?> <td><?php wp_dropdown_categories("orderby=name&hide_empty=0&hierarchical=1&include=$get_cat_id"); ?></td> </tr> <tr> <td><label for="post_tags">برچسب ها</label></td> <td><input type="text" name="post_tags" class="post_input" id="post_tags"/></td> </tr>ممنون میشم اگه کمک کنید نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .