I came across a nice bit of code the other day in a forum that a WordPress plugin developer posted. His name is Takayuki Miyoshi and he’s really got a brilliant product with Contact Form 7 in WordPress.
Anyhow, in case you were wondering here’s the copy and paste code to allow you to run custom shortcodes inside a Contact Form 7 form dynamically, which came directly from him. You simply paste it into your theme’s functions.php file and install the CF7 plugin:
//begin code
add_filter( ‘wpcf7_form_elements’, ‘mycustom_wpcf7_form_elements’ );
function mycustom_wpcf7_form_elements( $form ) {
$form = do_shortcode( $form );
return $form;
}
//end code
Using this code bit allows you to not have to touch the core CF7 plugin files and the freedom to execute any little snippet of php you want. Best of both worlds I think.