'; $links = get_post_meta($post->ID, 'link'); echo ''; echo ''; foreach ($links as $link) { echo ''; } echo '
'; } /* When the post is saved, saves our custom data */ function linkpreview_save_postdata( $post_id ) { // verify this came from the our screen and with proper authorization, // because save_post can be triggered at other times if ( !wp_verify_nonce( $_POST['linkpreview_noncename'], plugin_basename(__FILE__) )) { return $post_id; } // verify if this is an auto save routine. If it is our form has not been submitted, so we dont want // to do anything if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id; // Check permissions if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id ) ) return $post_id; } else { if ( !current_user_can( 'edit_post', $post_id ) ) return $post_id; } // OK, we're authenticated: we need to find and save the data delete_post_meta($post_id, 'link'); $links = $_POST['linkpreview_links']; foreach ($links as $link) { if (!empty($link)) add_post_meta($post_id, 'link', $link); } return $mydata; } ?>