Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i have this (test ) function that adds a redirection bouton

  function bouton($atts, $content = null) {
     extract(shortcode_atts(array(
             'lien' => '#',
             'couleur' =>'bleu'
             ), $atts));
     return '<a class="bouton '.$couleur.'" href="'.$lien.'" target="_blank">' . do_shortcode($content) . '</a>';
    }

this lines below allows the shortcode

      [bouton couleur="orange" lien="http://codex.wordpress.org/Shortcode_API"]L'API Shortcode WordPress[/bouton]

to work in contact form7 editor :

        function shortcodes_in_cf7( $form ) {
        $form = do_shortcode( $form );
        //place my short code below to work within contact form 7
        add_shortcode('bouton', 'bouton');
        return $form;
    }
    //line below to place ds form :
    add_filter( 'wpcf7_form_elements', 'shortcodes_in_cf7' );

i have replaced this filters by

            //add_filter( ' wpcf7_mail_components', 'shortcodes_in_cf7' );
    //add_filter( ' wpcf7_mail_tag_replaced', 'shortcodes_in_cf7' );
    //add_filter( ' wpcf7_display_message', 'shortcodes_in_cf7' );

to try and make it working in the email message with no succes .

What would be the filter to use?

share|improve this question

closed as off-topic by toscho Jul 26 at 9:53

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

Try with this instead :

wpcf7_add_shortcode('bouton', 'shortcodes_in_cf7_handler', true);
function shortcodes_in_cf7_handler($atts) {
    //code for shortcode
 }

You should be able to use shortcode in wpcf7 now.

share|improve this answer
    
thanks but i don't get it . could u give me the full code and procedure , let's say , to display in the sent email the $var="paris"; –  Matoeil Jul 25 '13 at 11:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.