I have a custom post type with many custom fields. I create a new post each day. Some of the custom fields only require small changes each day. I would like to pre-fill the custom fields in the admin 'Add New' form with the previous post's data. How would I edit my theme's function.php to achieve this? The code for my custom fields is below. Thank you!
function custom_profentia(){
add_meta_box("market_levels", "Market Levels", "market_levels", "profentia", "normal", "low");
}
function market_levels() {
global $post;
$custom = get_post_custom($post->ID);
$mldOne = $custom["mldOne"][0];
$mlbOne = $custom["mlbOne"][0];
$mldTwo = $custom["mldTwo"][0];
$mlbTwo = $custom["mlbTwo"][0];
$mldThree = $custom["mldThree"][0];
$mlbThree = $custom["mlbThree"][0];
$mldFour = $custom["mldFour"][0];
$mlbFour = $custom["mlbFour"][0];
$mldFive = $custom["mldFive"][0];
$mlbFive = $custom["mlbFive"][0];
?>
<div style="height:540px;">
<ul>
<li><label>Monday:</label><input name="mldOne" value="<?php echo $mldOne; ?>" /><br /><textarea cols="50" rows="3" name="mlbOne" class="attachmentlinks"><?php echo $mlbOne; ?></textarea></li>
<li><label>Tuesday:</label><input name="mldTwo" value="<?php echo $mldTwo; ?>" /><br /><textarea cols="50" rows="3" name="mlbTwo" class="attachmentlinks"><?php echo $mlbTwo; ?></textarea></li>
<li><label>Wednesday:</label><input name="mldThree" value="<?php echo $mldThree; ?>" /><br /><textarea cols="50" rows="3" name="mlbThree" class="attachmentlinks"><?php echo $mlbThree; ?></textarea></li>
<li><label>Thursday:</label><input name="mldFour" value="<?php echo $mldFour; ?>" /><br /><textarea cols="50" rows="3" name="mlbFour" class="attachmentlinks"><?php echo $mlbFour; ?></textarea></li>
<li><label>Friday:</label><input name="mldFive" value="<?php echo $mldFive; ?>" /><br /><textarea cols="50" rows="3" name="mlbFive" class="attachmentlinks"><?php echo $mlbFive; ?></textarea></li>
</ul>
</div>
<?php
}