Add Mailchimp list choice to WP comment form

This article involves adding code to your WordPress site, which should always be done with caution.

With our comment form integration you can let people sign up to your list with a simple checkbox. If you would like to offer a way for them to choose which list they can subscribe to, you’ll be glad to know that this is possible through our plugin.

Follow these steps to add list choice to your comment form:

  1. Login to your WordPress Dashboard and go to MC4WP > Forms and click on Create New Form.
  2. From the Add new field option, select List Choice. This will immediately show the code required to display the List options.
  3. Copy the generated HTML code and paste it inside a function like the one below. Make sure you replace ListIDgoeshere with your own List ID!
  4. Place the function inside your functions.php file.
function myprefix_show_list_choice_in_comment_form() {
?>
<h4>Choose the lists you wish to subscribe to..</h4>
<p>
	<label>
		<input type="checkbox" name="_mc4wp_lists[]" value="id-of-list-1" />List 01
	</label>
	<label>
		<input type="checkbox" name="_mc4wp_lists[]" value="id-of-list-2" />List 02
	</label>
	<label>
		<input type="checkbox" name="_mc4wp_lists[]" value="id-of-list-3" />List 03
	</label>
</p>
<?php
}

add_action( 'comment_form', 'myprefix_show_list_choice_in_comment_form' );

Your users can now select the list they wish to subscribe to. You can also add the List choice option to the Registration form.

You can also use radio buttons to limit the list choice to 1. Lean how to replace checkboxes with radio buttons.