WordPress.org

Forums

ALO EasyMail Newsletter
Add "select" custom field (2 posts)

  1. Giulio Pecorella
    Member
    Posted 1 year ago #

    Hello,

    I am using ALO EasyMail Newsletter 2.5.01 with WordPress 3.5.1.

    I need to add some custom fields to the subscription form.

    I have no problems adding text fields but how do I add some "select" fields and their options?

    https://wordpress.org/plugins/alo-easymail/

  2. eventualo
    Member
    Plugin Author

    Posted 1 year ago #

    Inside the plugin (mu-plugins/alo-easymail_custom-fields.php) you can find this sample that adds a "Favourie music" dropdown to subscription form:

    function custom_easymail_set_my_custom_fields ( $fields ) {
    	// Custom field: Fovourite music
    	$fields['cf_music'] = array(
    		'humans_name'		=> __("Favourite music", "alo-easymail"),
    		'sql_attr' 			=> "VARCHAR(100) DEFAULT NULL",
    		'sql_key' 			=> true,
    		'input_type' 		=> "select",
    		'input_options' 	=> array(
    			"" 			=> '',
    			"rock" 		=> __("Rock / Metal", "alo-easymail"),
    			"jazz" 		=> __("Jazz", "alo-easymail"),
    			"classic" 	=> __("Classic", "alo-easymail"),
    			"country" 	=> __("Country / Folk", "alo-easymail"),
    			"other" 	=> __("Other", "alo-easymail")
    		),
    		'input_mandatory' 	=> false,
    		'input_validation' 	=> false,
    		'input_attr'		=> "style=\"color: #f00\""
    	);
    	return $fields;
    }
    add_filter ( 'alo_easymail_newsletter_set_custom_fields', 'custom_easymail_set_my_custom_fields' );

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • ALO EasyMail Newsletter
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic