Ocultar fun??o no painel
-
Criei a seguinte fun??o para criar post no Front-end, mas ela esta aparecendo no meu painel, como fa?o para aparecer somente no meu front-end?
<?php if(isset($_POST['message'])){ $post = array( 'post_title' => strip_tags($_POST['title']), 'post_content' => strip_tags($_POST['message']), 'post_status' => 'publish', 'post_type' => 'testimonial' ); $post_id = wp_insert_post( $post ); if($_FILES["image"]["type"] =="image/gif" or $_FILES["image"]["type"] =="image/png" or $_FILES["image"]["type"] =="image/jpeg" ) { if(!empty($_FILES["image"])) { $uploads = wp_upload_dir(); $fileName = $_FILES["image"]["name"]; $fileTmpLoc = $_FILES["image"]["tmp_name"]; $uzanti = pathinfo($fileName, PATHINFO_EXTENSION); $remove_these = array(' ','','"','\'','\\','/'); $fileName = str_replace($remove_these,'', $_FILES['image']['name']); $newname = time().'-hepyorum.'.$uzanti; $pathAndName = $uploads['path'].'/'.$newname; $moveResult = move_uploaded_file($fileTmpLoc, $pathAndName); if ($moveResult == true) { // echo "File has been moved from " . $fileTmpLoc . " to " . $pathAndName; $resimadresi = 'https://www.hepyorum.com/'.substr($pathAndName, 27); // add_post_meta($post_id, 'resim' , $resimadresi, true ); $filename = $pathAndName; $parent_post_id = $post_id; $filetype = wp_check_filetype( basename( $filename ), null ); $wp_upload_dir = wp_upload_dir(); $attachment = array( 'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ), 'post_mime_type' => $filetype['type'], 'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ), 'post_content' => '', 'post_status' => 'inherit' ); $attach_id = wp_insert_attachment( $attachment, $filename, $parent_post_id ); require_once( ABSPATH . 'wp-admin/includes/image.php' ); $attach_data = wp_generate_attachment_metadata( $attach_id, $filename ); wp_update_attachment_metadata( $attach_id, $attach_data ); $resimadresi = wp_get_attachment_url( $attach_id ); set_post_thumbnail( $post_id, $attach_id ); } else { // echo "ERROR"; } } } } ?> <form action="<?php the_permalink(); ?>" method="post" enctype="multipart/form-data"> <textarea class="i2" name="message" placeholder="comment"></textarea> <input type="text" name="title" class="i1" placeholder="Title"> <label class="i4"> Foto: <input type="file" name="image" placeholder="Foto"> </label> <input type="submit" value="Enviar" class="i3"> </form>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Ocultar fun??o no painel’ is closed to new replies.