Recently I’ve been having an issue with one of my sites that I wanted to start building an email list. One problem was that – due to the nature of the site – I couldn’t use my mailing list of choice of Mailchimp hooked in with WP Email Capture. I decided to use Gravity Forms to capture email addresses, and also I wanted a “Subscribe to Newsletter as you Comment” button (the site receives a lot of comments). So I wanted people – when they tick the box – to be added as an entry in Gravity Forms, which can then be exported. Thankfully, this is quite straightforward to do using a couple of functions, one of which is native to WordPress, the other is using the Gravity Forms API. Add A Comment Field to WordPress WordPress allows you to add a comment field to the comment form using the comment_form_default_fields action. This action is run after the Name/Email/Website fields but before the textarea box, allowing some control of what you wish to add. We’re going to add a checkbox entitled “addtoemail” which can be ticked. function winwar_add_to_email_list_field( $fields ) { $fields['add-to-email'] = '
Share This