Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/07/2012, 10:37
Avatar de raid_
raid_
 
Fecha de Ingreso: diciembre-2010
Mensajes: 132
Antigüedad: 13 años, 4 meses
Puntos: 12
vista prefia en formulario

Hola, he creado un frontend para poder publicar articulos desde wordpress, que funciona bien, aun le quedan ajuste, pero me gustaria añadirle un boton de vista previa, que se muestre en la misma pagina, o a poder ser que se abra en un lightbox, prefiero esta ultima, pero no encuentro la manera de realizarlo.

este es el codigo que estoy utilizando


Código PHP:
<?php
/*
Template Name: Mejores practicas
*/
if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {
 
    
// Do some minor form validation to make sure there is content
    
if (isset ($_POST['title'])) {
        
$title =  $_POST['title'];
    } else {
        echo 
'Please enter the wine name';
    }
    if (isset (
$_POST['proposito'])) {
        
$description $_POST['proposito'];
    } else {
        echo 
'Please enter some notes';
    }

    
$tags $_POST['post_tags'];
    
$descripcion1 $_POST['descripcion1'];
    
$innovacion $_POST['innovacion'];
    
$herramientas $_POST['herramientas'];
    
$estrategia $_POST['estrategia'];
    
$dificultades $_POST['dificultades'];
    
$organizacion $_POST['organizacion'];
    
$enlace1 $_POST['enlace1'];
    
$enlace2 $_POST['enlace2'];
    
    
$prueba $_POST['regi'];
    
// ADD THE FORM INPUT TO $new_post ARRAY
    
$new_post = array(
    
'post_title'    =>    $title,
    
'post_content'    =>    $description,
    
'tax_input'    =>    array ('tipo' => array ($prueba)),  // Usable for custom taxonomies too
    
'tags_input'    =>    array($tags),
    
'post_status'    =>    'publish',           // Choose: publish, preview, future, draft, etc.
    
'post_type'    =>    'practicas',  //'post',page' or use a custom post type if you want to
    
);

    
//SAVE THE POST
    
$pid wp_insert_post($new_post);

             
//KEEPS OUR COMMA SEPARATED TAGS AS INDIVIDUAL
    
wp_set_post_tags($pid$_POST['post_tags']);

    
//REDIRECT TO THE NEW POST ON SAVE
    
$link get_permalink$pid );
    
wp_redirect$link );

    

//POST THE POST YO
do_action('wp_insert_post''wp_insert_post');
y este el formularios

Código PHP:
<form id="new_post" name="new_post" method="post" action="" class="wpcf7-form" enctype="multipart/form-data">
                
                <div class="registro_tit2">
                <img src="<?php echo $img_url.'registro-2.gif';?>" alt=""/>
            </div>
            
            <div class="registro_nombres">
                    <label for="title">Titulo</label>
                    <label for="cat">Categoria</label>
                    <label for="description">Proposito General</label>
                    <label for="organizacion">Buena Pr&aacute;ctica en su Organizaci&oacute;n</label>
                    <label for="proyecto">Buena Pr&aacute;ctica en un proyecto</label>
            </div>  
            <div class="registro_campos">    
            <input type="text" id="title" value="" style="width: 80%; margin: 5px 10px 5px 10px; padding: 5px 10px 5px 10px;" name="title" />
            <fieldset class="category">
                <?php wp_dropdown_categories'show_option_none=Selecciones Categoria&name=regi&tab_index=10&taxonomy=tipo&hide_empty=0' ); ?>
            </fieldset>
            <textarea id="proposito" tabindex="15" name="proposito" style="width: 80%; margin: 12px 10px 5px 10px; padding: 5px 10px 5px 10px;"/><?php echo $_POST['proposito']; ?> </textarea>
            <input value="si" name="organizacion" <?php if (is_array($_POST['organizacion'])) { if ($error && in_array("si"$_POST['organizacion'])) { ?>checked="checked"<?php } }?> type="checkbox"style="width: 10%; margin: 25px 295px 35px 0px; padding: 5px 10px 5px 0px;" />
            <input value="si" name="proyecto" <?php if (is_array($_POST['organizacion'])) { if ($error && in_array("si"$_POST['organizacion'])) { ?>checked="checked"<?php } }?> type="checkbox"style="width: 10%; margin: 25px 295px 35px 0px; padding: 5px 10px 5px 0px;" />
                    
            </div> 
            <div class="separacion"></div>
            <div class="registro_tit2">
                <img src="<?php echo $img_url.'registro-3.gif';?>" alt=""/>
                </div>
                <div class="registro_nombres">
                    <label for="descripcion">Descripción General</label>
                    <label for="innovacion" style="margin-top: 24px;">Innovación</label>
                    <label for="herramientas" style="margin-top: 25px;">Herramientas</label>
                    <label for="estrategia" style="margin-top: 24px;">Estratégia</label>
                    <label for="dificultades" style="margin-top: 24px;">Dificultadeos o Posibles Retos</label>
                    <label for="practica">Información Útil</label>
                    <label for="publico">Más Información</label>
                 </div>    
                
            
                </div>

                <div class="separacion"></div>
            <fieldset class="submit">
                <input type="submit" value="Post yyReview" tabindex="40" id="submit" name="submit" />
            </fieldset>


            <input type="hidden" name="action" value="new_post" />
            <?php wp_nonce_field'new-post' ); ?>
            </form>
No he puesto el codigo completo, pertenecen a campos personalizados, y algunas cosillas mas, pero se puede ver como lo tengo montado,

estaria muy agradecio cualquier ayuda, llevo 2 dias buscando soluciones y no doy con ella


gracias