php - Edit form for custom loop post -


so, have custom loop post.

on page, have 10 posts below:

<?php    $args = array(      'post_type' => 'mail',     'paged'=>$paged,     'posts_per_page' => 10,     'mail_cat' => '',     'orderby' => 'date',     'order' => 'desc',           );       $loop = new wp_query( $args );   while ( $loop->have_posts() ) : $loop->the_post();  ?> 

each post gets title, content , price based on data-mail_id below:

<div data-mail_id="' . esc_attr( $mail->id ) . '">     <?php the_title(); ?>     <?php the_content(); ?>     <?php echo $mail->get_price_html(); ?> </div> 

now, how can add edit form (<form>) edit post contents?

i guessing need following:

  1. get <form> targeted post-mail_id data such title.
  2. change contents of post
  3. submit change update data specific post-mail_id.

what guys think?

edit 1:

well, not sure if correct, start :p

<form role="form" method="post">                         <?php wp_nonce_field( 'update_post_'. get_the_id(), 'update_post_nonce' ); ?>                                <div id="title_change">                                                  <input type="text" id="post_title" name="post_title" value="<?php echo $post->post_title; ?>"></input>                       <input  type="submit" name="update" type="submit" ></input>     </div> </form> 

so, what? lol

so, can show original title in input field. not sure how change can submitted , updated.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -