< ?php /* Template Name: Contacto */ ?>
< ?phpif($_POST[sent]){ $error = “”; if(!trim($_POST[tu_nombre])){ $error .= “
Por favor, tu nombre es…”;
}
if(!filter_var(trim($_POST[tu_email]),FILTER_VALIDATE_EMAIL)){
$error .= “
El email no es válido
”;
}
if(!trim($_POST[tu_mensaje])){
$error .= “
Quizá olvidaste el mensaje…
”;
}
if(!trim($_POST[el_asunto])){
$error .= “
Falta el asunto
”;
}
if(!$error){
$email = wp_mail(get_option(“admin_email”),trim($_POST[tu_nombre]).” Se ha enviado un mensaje desde “.get_option(“blogname”),stripslashes(trim($_POST[tu_mensaje])),”De: “.trim($_POST[tu_nombre]).” < ”.trim($_POST[tu_email]).”>rnReply-To:”.trim($_POST[tu_email]));
}
}
?>
< ?php get_header(); ?>
< ?php the_title(); ?>
Mensaje enviado. Te responderemos lo antes posible
< ?php } else { if($error) { ?>
Tu mensaje NO ha sido enviado
< ?php echo $error; ?>
< ?php } else { the_content(); } ?>
< ?php } ?>
< !– .entry-content –>
< !– #post-## –>
< ?php endwhile; ?>
< !– #content –>
< !– #container –>
< ?php get_footer(); ?>