Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $myposts = get_posts($args);
- foreach( $myposts as $post ) : setup_postdata($post);
- $checked = is_array($cats) && in_array(get_the_ID(), $cats) ? 'checked="checked"' : '';
- ?>
- <label><input <?php echo $checked; ?> type="checkbox" name="myposts[]" value="<?php the_ID(); ?>" id="myposts[]" /><?php the_title(); ?></label>
- <br>
- Custo <input type="text" name="etapa_custo[<?php echo $post_id?>]" value="" />
- <br>
- <?php
- endforeach;
- }
- }
- add_action( 'save_post', 'salvar_post_etapas' );
- function salvar_post_etapas( $post_id ){
- if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
- if( isset( $_POST['myposts'])){
- update_post_meta( $post_id, 'myposts', $_POST['myposts']);
- }else{
- update_post_meta( $post_id, 'myposts', array());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment