• Hello,
    I’m trying to add Selectable Recipient email(with PIPES fonctionality) to my contact form 7.

    But the probleme is that I also want to get my email with a custom shortcode parsing a custum field of a custom post.
    I have a custom post agency and a cutstom fields mail_agency.

    So I create a new shortcode like this :

    function get_the_agency($atts, $content = null) {
    	$args = array(
    		'post_type'		=> 'agency',
    		'showposts'		=> '-1'
    	);
    	$query = new WP_Query($args);
    
    	$list_agency ="";
    	$mails_list = "";
    
    	if ( $query->have_posts() ) while ( $query->have_posts() ) : $query->the_post();
    
    		$mails_list .= ' "' . get_the_title() . "|" . get_field("mail_agency", $post->ID) .'"';
    // get_field by advancedcustomfields plugin
    
    	endwhile; wp_reset_postdata();
    
    	$list_agency = '[select recipient-email id:agency-form ' . $mails_list . ']';
    
    	return wpcf7_do_shortcode($list_agency);
    }
    
    add_shortcode( 'agency', 'get_the_agency' );

    And if I put [agency] in my form, my shortcode is executed but the pipes fonctionality for the email adress won’t work (I think)
    The value/text is good <option value="my_title">mytitle</option> but I’m unabled to send the form, It’s like recipient-email is empty…

    But if I delete the first part of $mails_list :
    $mails_list .= ' "' . get_field("mail_agency", $post->ID) .'"';

    Everything work perfectly, my from send my email but all my email adresse are visible in my code …
    <option value="email@gmail.com">email@gmail.com</option>

    I also test to copy my return $list_agency shortcode directly in my contact form 7 admin and save, and everything works.

    So How to can I do to make this work like in this exemple :

    http://contactform7.com/selectable-recipient-with-pipes/

    but with the possibily to get all my email adress dynamicly with a new shortcode ?

    Please, help !!

    http://wordpress.org/extend/plugins/contact-form-7/

  • The topic ‘Selectable Recipient with Pipes, but in other shortcode’ is closed to new replies.