This topic has 6 replies, 4 voices, and was last updated 10 years by Abe.

  • Author

    Tagged: 

  • #37762
     JoeHowla
    Participant

    I love the little envelope icon that floats on the page to be able to open and contact the company but I need to have it require a phone number, not just an email and name but I can’t find anywhere in the settings how to add sections to the contact form and can’t find which file to edit so just wondering how I could be able to add that field to the quick contact?

    #37987
     sharmstr
    Moderator

    There isnt a setting for that. You’ll have to customize the kleo_contact_form and the kleo_sendmail functions using your child theme functions.php file. Here’s the form code you need to edit

    COPY CODE
    
    function kleo_contact_form( $atts, $content = null ) {
    		extract(shortcode_atts(array(
    			'title'    	 => 'CONTACT US'
    		), $atts));
    	
    		$output = '';
    		
    		$output .= '<div class="kleo-quick-contact-wrapper">'
    			.'<a href="#"><i class="icon-mail-alt"></i></a>'
    			.'<div id="kleo-quick-contact">'
    				.'<h4 class="kleo-qc-title">'. $title .'</h4>'
    				.'<p>'. do_shortcode($content).'</p>'
    				.'<form class="kleo-contact-form" action="#" method="post" novalidate>'
    					.'<input type="text" placeholder="'.__("Your Name",'kleo_framework').'" required id="contact_name" name="contact_name" class="form-control" value="" tabindex="276" />'
    					.'<input type="email" required placeholder="' . __("Your Email",'kleo_framework') . '" id="contact_email" name="contact_email" class="form-control" value="" tabindex="277"  />'
    					.'<textarea placeholder="' . __("Type your message...",'kleo_framework') . '" required id="contact_content" name="contact_content" class="form-control" tabindex="278"></textarea>'
    						.'<input type="hidden" name="action" value="kleo_sendmail">'
    						.'<button tabindex="279" class="btn btn-default pull-right" type="submit">'. __("Send",'kleo_framework').'</button>'
    					.'<div class="kleo-contact-loading">'. __("Sending",'kleo_framework').' <i class="icon-spinner icon-spin icon-large"></i></div>'
    					.'<div class="kleo-contact-success"> </div>'
    				.'</form>'
    				.'<div class="bottom-arrow"></div>'
    			.'</div>'
    		.'</div><!--end kleo-quick-contact-wrapper-->';
    			
    		return $output;
    	}
    	add_shortcode('kleo_contact_form', 'kleo_contact_form');
    
    
    function kleo_sendmail()
    	{
    		if(isset($_POST['action'])) {
    
    			$error_tpl = "<span class='mail-error'>%s</span>";
    			
    			//contact name
    			if(trim($_POST['contact_name']) === '') 
    			{
    				printf($error_tpl, __('Please enter your name.','kleo_framework') );
    				die();
    			}
    			else 
    			{
    				$name = trim($_POST['contact_name']);
    			}
    
    			///contact email
    			if(trim($_POST['contact_email']) === '') 
    			{
    				printf($error_tpl, __('Please enter your email address.','kleo_framework') );
    				die();
    			} 
    			elseif (!preg_match("/^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+.[a-z]{2,4}$/i", trim($_POST['contact_email']))) 
    			{
    				printf($error_tpl, __('You entered an invalid email address.','kleo_framework') );
    				die();
    			} 
    			else 
    			{
    				$email = trim($_POST['contact_email']);
    			}
    
    			//message
    			if(trim($_POST['contact_content']) === '') 
    			{
    				printf($error_tpl, __('Please enter a message.','kleo_framework') );
    				die();
    			} 
    			else 
    			{
    				if(function_exists('stripslashes')) {
    					$comment = stripslashes(trim($_POST['contact_content']));
    				} else {
    					$comment = trim($_POST['contact_content']);
    				}
    			}
    
    			$emailTo = sq_option('contact_form_to','');
    			if (!isset($emailTo) || ($emailTo == '') )
    			{
    				$emailTo = get_option('admin_email');
    			}
    
    			$subject = __('Contact Form Message','kleo_framework');
    			apply_filters('kleo_contact_form_subject',$subject);
    
    			$body = __("You received a new contact form message:", 'kleo_framework');
    			$body .= __("Name: ", 'kleo_framework') . $name . "<br>";
    			$body .= __("Email: ", 'kleo_framework') .$email . "<br>" ;
    			$body .= __("Message: ", 'kleo_framework') . $comment . "<br>";
    
    			$headers[] = "Content-type: text/html";
    			$headers[] = "Reply-To: $name <$email>";
    			apply_filters('kleo_contact_form_headers',$headers);
    
    			if(wp_mail($emailTo, $subject, $body, $headers))
    			{
    				echo '<span class="mail-success">' . __("Thank you. Your message has been sent.", 'kleo_framework').' <i class="icon-ok icon-large"></i></span>';
    
    				do_action('kleo_after_contact_form_mail_send', $name, $email, $comment);
    			}
    			else
    			{
    				printf($error_tpl, __("Mail couldn't be sent. Please try again!",'kleo_framework') );
    			}
    
    		}
    		else
    		{
    			printf($error_tpl, __("Unknown error ocurred. Please try again!",'kleo_framework') );
    		}
    		 die();
    	}
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #38015
     JoeHowla
    Participant

    I added all of the above code to the Kleo Child Theme Function but nothing in the contact from changed. Maybe I misunderstood where to put the code and I cleared the cache and still nothing changed on the form input fields.

    #38016
     sharmstr
    Moderator

    I didn’t edit the code for you. I just gave the functions you need to edit.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #38235
     Kamal
    Moderator

    Hello @JoeHowla,
    I am trying to edit the code and prepare the code for accomplishing your purpose. Please give me some time to test the code. 🙂

    @sharmstr
    : Thank you very much for the code. I was searching for this on different folders and templates to edit them. Thanks for your help. 🙂
    Regards,
    Kamal

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #38262
     JoeHowla
    Participant

    Thank you. I am not very good at code so this would be a great addition. I looked and looked as well but couldn’t find it.

    #39457
     Abe
    Keymaster

    Hi, normally this is considered custom work but if Kamal promised you to do it, attached is the code you need to add to your child theme functions.php

    that will override default theme functionality and add the extra Phone input text.

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    Attachments:
    You must be logged in to view attached files.
Viewing 7 posts - 1 through 7 (of 7 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?