Thanks Matt,that works great and put me onto the track of adapting this to my own wishes. I needed to pass parameters to the form but could not use the URL; what I’ve done below is slightly adapt your code so I can pass parameters to text fields using WP’s ‘Custom Fields’.
What I do is add a custom field to a post, let’s say with the name “Itin” (for Itinerary) where the key will hold the Itinerary-code I want to pass to the form. Then, I add “CF_fieldname” to the text-field definition in the contact form. So for instance, to get the ‘Itin’ custom field into the ‘itin-code’ textfield, I can use:
Itinerary code: [text itin-code 30/30 "CF_Itin"]
That way, any custom field can be put in any text field. The adapted code (replacing, as above: $value = $values[0];
with:
$match = strpos($values[0], 'CF_');
if ($match === false) {
$value = $values[0];
} else {
global $post, $key;
$values[0] = str_replace('CF_', '', $values[0]);
$key = $values[0];
$value = get_post_meta($post->ID, $key, true);
}
</code></p>
Though in no way beautiful (not a PHP programmer) it works, and might be useful to others.
Niels.