PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Multiple Shortcode Parameters for one Checkbox

  1. Hi,

    I'm not sure if this is possible, but I'm giving it a try.

    I want to be able to let readers sign up for email updates (connected with MailChimp) for the categories of an individual post.

    So for example, a post is categorized "red" and "blue."

    A user reading that post would be able to write in their email address, and a hidden checkbox would select categories "red" and "blue."

    Right now trying to use a shortcode to dynamically populate a checkbox. When there are multiple categories, however, I can't get it to work. Is there any way to insert multiple parameters into one checkbox?

    I'm sure I'm not doing this correctly, but would appreciate if there is a way to multi-select checkboxes. This is what I'm trying right now, listed the terms seperated by &. Not suprisingly, its not working.

    if ( $terms && ! is_wp_error( $terms ) ) : 
    
    	$ppr_categories = array();
    
    	foreach ( $terms as $term ) {
    		$ppr_categories[] = $term->name;
    	}
    
    	$on_ppr = join( "&", $ppr_categories );
    
    echo do_shortcode('[gravityforms id=11 field_values="categories=' . $on_ppr . '"]');
    
    endif;
    Posted 11 years ago on Wednesday May 9, 2012 | Permalink