front page.php,front-page.php

if ( get_option( 'show_on_front' ) == 'page' ) {

include( get_page_template() );

}else {

if(isset($_POST['submitted']) && !defined('PIRATE_FORMS_VERSION') && !shortcode_exists( 'pirate_forms' ) ) :

/* recaptcha */

$zerif_contactus_sitekey = get_theme_mod('zerif_contactus_sitekey');

$zerif_contactus_secretkey = get_theme_mod('zerif_contactus_secretkey');

$zerif_contactus_recaptcha_show = get_theme_mod('zerif_contactus_recaptcha_show');

if( isset($zerif_contactus_recaptcha_show) && $zerif_contactus_recaptcha_show != 1 && !empty($zerif_contactus_sitekey) && !empty($zerif_contactus_secretkey) ) :

$captcha='';

if( isset($_POST['g-recaptcha-response']) ){

$captcha=$_POST['g-recaptcha-response'];

}

if( !$captcha ){

$hasError = true;

}

$response = wp_remote_get( "https://www.google.com/recaptcha/api/siteverify?secret=".esc_html($zerif_contactus_secretkey)."&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR'] );

if($response['body'].success==false) {

$hasError = true;

}

endif;

/* name */

if(trim($_POST['myname']) === ''):

$nameError = __('* Please enter your name.','zerif-lite');

$hasError = true;

else:

$name = trim($_POST['myname']);

endif;

/* email */

if(trim($_POST['myemail']) === ''):

$emailError = __('* Please enter your email address.','zerif-lite');

$hasError = true;

elseif (!preg_match("/^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$/i", trim($_POST['myemail']))) :

$emailError = __('* You entered an invalid email address.','zerif-lite');

$hasError = true;

else:

$email = trim($_POST['myemail']);

endif;

/* subject */

if(trim($_POST['mysubject']) === ''):

$subjectError = __('* Please enter a subject.','zerif-lite');

$hasError = true;

else:

$subject = trim($_POST['mysubject']);

endif;

/* message */

if(trim($_POST['mymessage']) === ''):

$messageError = __('* Please enter a message.','zerif-lite');

$hasError = true;

else:

$message = stripslashes(trim($_POST['mymessage']));

endif;

/* send the email */

if(!isset($hasError)):

$zerif_contactus_email = get_theme_mod('zerif_contactus_email');

if( empty($zerif_contactus_email) && !is_email($zerif_contactus_email) ):

$zerif_email = get_theme_mod('zerif_email');

$emailTo = is_email($zerif_email);

else:

$emailTo = $zerif_contactus_email;

endif;

if(isset($emailTo) && $emailTo != ""):

if( empty($subject) ):

$subject = 'From '.$name;

endif;

$body = "Name: $name \n\nEmail: $email \n\n Subject: $subject \n\n Message: $message";

/* FIXED HEADERS FOR EMAIL NOT GOING TO SPAM */

$zerif_admin_email = get_option( 'admin_email' );

$zerif_sitename = strtolower( $_SERVER['SERVER_NAME'] );

function zerif_is_localhost() {

$zerif_server_name = strtolower( $_SERVER['SERVER_NAME'] );

return in_array( $zerif_server_name, array( 'localhost', '127.0.0.1' ) );

}

if ( zerif_is_localhost() ) {

$headers = 'From: '.$name.' ' . "\r\n" . 'Reply-To: ' . $email;

} else {

if ( substr( $zerif_sitename, 0, 4 ) == 'www.' ) {

$zerif_sitename = substr( $zerif_sitename, 4 );

}

$headers = 'From: '.$name.' ' . "\r\n" . 'Reply-To: ' . $email;

}

wp_mail($emailTo, $subject, $body, $headers);

$emailSent = true;

else:

$emailSent = false;

endif;

endif;

endif;

$zerif_bigtitle_show = get_theme_mod('zerif_bigtitle_show');

if( isset($zerif_bigtitle_show) && $zerif_bigtitle_show != 1 ):

get_template_part( 'sections/big_title' );

endif;

?>

/* OUR FOCUS SECTION */

$zerif_ourfocus_show = get_theme_mod('zerif_ourfocus_show');

if( isset($zerif_ourfocus_show) && $zerif_ourfocus_show != 1 ):

zerif_before_our_focus_trigger();

get_template_part( 'sections/our_focus' );

zerif_after_our_focus_trigger();

endif;

/* RIBBON WITH BOTTOM BUTTON */

get_template_part( 'sections/ribbon_with_bottom_button' );

/* ABOUT US */

$zerif_aboutus_show = get_theme_mod('zerif_aboutus_show');

if( isset($zerif_aboutus_show) && $zerif_aboutus_show != 1 ):

zerif_before_about_us_trigger();

get_template_part( 'sections/about_us' );

zerif_after_about_us_trigger();

endif;

/* OUR TEAM */

$zerif_ourteam_show = get_theme_mod('zerif_ourteam_show');

if( isset($zerif_ourteam_show) && $zerif_ourteam_show != 1 ):

zerif_before_our_team_trigger();

get_template_part( 'sections/our_team' );

zerif_after_our_team_trigger();

endif;

/* TESTIMONIALS */

$zerif_testimonials_show = get_theme_mod('zerif_testimonials_show');

if( isset($zerif_testimonials_show) && $zerif_testimonials_show != 1 ):

zerif_before_testimonials_trigger();

get_template_part( 'sections/testimonials' );

zerif_after_testimonials_trigger();

endif;

/* RIBBON WITH RIGHT SIDE BUTTON */

get_template_part( 'sections/ribbon_with_right_button' );

/* LATEST NEWS */

$zerif_latestnews_show = get_theme_mod('zerif_latestnews_show');

if( isset($zerif_latestnews_show) && $zerif_latestnews_show != 1 ):

zerif_before_latest_news_trigger();

get_template_part( 'sections/latest_news' );

zerif_after_latest_news_trigger();

endif;

/* CONTACT US */

$zerif_contactus_show = get_theme_mod('zerif_contactus_show');

if( isset($zerif_contactus_show) && $zerif_contactus_show != 1 ):

?>

$zerif_contactus_title = get_theme_mod('zerif_contactus_title',__('Get in touch','zerif-lite'));

if ( !empty($zerif_contactus_title) ):

echo '

'.wp_kses_post( $zerif_contactus_title ).'

';

elseif ( is_customize_preview() ):

echo '

';

endif;

$zerif_contactus_subtitle = get_theme_mod('zerif_contactus_subtitle');

if(isset($zerif_contactus_subtitle) && $zerif_contactus_subtitle != ""):

echo '

'.wp_kses_post( $zerif_contactus_subtitle ).'
';

elseif ( is_customize_preview() ):

echo '

'.$zerif_contactus_subtitle.'
';

endif;

?>

if ( defined('PIRATE_FORMS_VERSION') && shortcode_exists( 'pirate_forms' ) ):

echo '

';

echo do_shortcode('[pirate_forms]');

echo '

';

else:

?>

if(isset($emailSent) && $emailSent == true) :

echo '

'.__('Thanks, your email was sent successfully!','zerif-lite').'

';

elseif(isset($_POST['submitted'])):

echo '

'.__('Sorry, an error occured.','zerif-lite').'

';

endif;

if(isset($nameError) && $nameError != '') :

echo '

'.esc_html($nameError).'

';

endif;

if(isset($emailError) && $emailError != '') :

echo '

'.esc_html($emailError).'

';

endif;

if(isset($subjectError) && $subjectError != '') :

echo '

'.esc_html($subjectError).'

';

endif;

if(isset($messageError) && $messageError != '') :

echo '

'.esc_html($messageError).'

';

endif;

?>

">

$zerif_contactus_button_label = get_theme_mod('zerif_contactus_button_label',__('Send Message','zerif-lite'));

if( !empty($zerif_contactus_button_label) ):

echo ''.$zerif_contactus_button_label.'';

elseif ( is_customize_preview() ):

echo '';

endif;

?>

$zerif_contactus_sitekey = get_theme_mod('zerif_contactus_sitekey');

$zerif_contactus_secretkey = get_theme_mod('zerif_contactus_secretkey');

$zerif_contactus_recaptcha_show = get_theme_mod('zerif_contactus_recaptcha_show');

if( isset($zerif_contactus_recaptcha_show) && $zerif_contactus_recaptcha_show != 1 && !empty($zerif_contactus_sitekey) && !empty($zerif_contactus_secretkey) ) :

echo '

endif;

?>

endif;

?>

endif;

}

get_footer(); ?>

一键复制

编辑

Web IDE

原始数据

按行查看

历史

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值