JoeHana
10/22/2013 - 11:41 PM

Custom Contact Form

Custom Contact Form

<?php

/**
 * Custom Contact Form
 */
 
add_filter('wpsight_contact_fields', 'custom_contact_fields');

function custom_contact_fields($contact_fields) {
	
	// Get labels
	$contact_labels = wpsight_contact_labels();
	
	// Extract labels
	extract( $contact_labels, EXTR_SKIP );

	// Set contact fields

	$contact_fields = array(
	
		'fields_1' => array(
			'id' 		  	 => 'contact_name',
			'label'		  	 => $name,
			'label_email'  	 => $name_email,
			'required'	  	 => true,
			'type'		  	 => 'text',
			'placeholder' 	 => true,
			'before'		 => false,
			'after'			 => false,
			'value'			 => false,
			'position'	  	 => 10
		),
		'fields_2' => array(
			'id' 		  	 => 'contact_email',
			'label'		  	 => $email,
			'label_email'  	 => $email_email,
			'required'	  	 => 'email',
			'type'		  	 => 'text',
			'placeholder' 	 => true,
			'before'		 => false,
			'after'			 => false,
			'value'			 => false,
			'position'	  	 => 20
		),
		'fields_3' => array(
			'id' 		  	 => 'contact_phone',
			'label'		  	 => $phone,
			'label_email'  	 => $phone_email,
			'required'	  	 => true,
			'type'		  	 => 'text',
			'placeholder' 	 => true,
			'before'		 => false,
			'after'			 => false,
			'value'			 => false,
			'position'	  	 => 30
		),
		'fields_4' => array(
			'id' 		  	 => 'contact_message',
			'label'		  	 => $message,
			'label_email' 	 => $message_email,
			'required'	  	 => true,
			'type'		  	 => 'textarea',
			'placeholder' 	 => true,
			'before'		 => false,
			'after'			 => false,
			'value'			 => false,
			'position'	  	 => 40
		),
		'captcha' => array(
			'show' 		  	 => true,
			'type'			 => 'string', // can be 'math'
			'placeholder' 	 => false,
			'case_sensitive' => false,
			'code_length'	 => 4,
			'image_width' 	 => 150,
			'image_height'	 => 60,
			'perturbation' 	 => .5,
			'bg_color' 		 => '#ffffff',
			'text_color' 	 => '#606060',
			'num_lines' 	 => 6,
			'line_color' 	 => '#6e6e6e',
			'font'		  	 => './AHGBold.ttf',
			'before'		 => false,
			'after'			 => false,
			'value'			 => false,
			'position'		 => false // will be placed at the end
		),
		'copy'	  => array(
			'show' 			 => true,
			'placeholder' 	 => false,
			'position'		 => false // will be placed at the end
		)
		
	);
	
	return $contact_fields;
}