267 lines
6.5 KiB
PHP
267 lines
6.5 KiB
PHP
<?php
|
|
/**
|
|
* Template Name: Contact Page
|
|
*/
|
|
|
|
get_header(); ?>
|
|
|
|
<!-- Hero section -->
|
|
<section class="page-hero">
|
|
<div class="hero-content">
|
|
<h1><?php the_title(); ?></h1>
|
|
<p>Let's plan your next adventure together</p>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Contact section -->
|
|
<section class="contact">
|
|
<div class="container">
|
|
<div class="contact-grid">
|
|
<div class="contact-info">
|
|
<h2>Get in Touch</h2>
|
|
<div class="info-item">
|
|
<i class="fas fa-map-marker-alt"></i>
|
|
<p>Ob Farjevcu 50, 1000 Ljubljana, Slovenia</p>
|
|
</div>
|
|
<div class="info-item">
|
|
<i class="fas fa-phone"></i>
|
|
<p>+386 (0) 31 332 823</p>
|
|
</div>
|
|
<div class="info-item">
|
|
<i class="fas fa-envelope"></i>
|
|
<p>info@europewonder.com</p>
|
|
</div>
|
|
</div>
|
|
<div class="contact-form">
|
|
<form id="contact-form">
|
|
<?php wp_nonce_field('contact_form_nonce', 'contact_security'); ?>
|
|
<input type="hidden" name="action" value="contact_form_submit">
|
|
<div class="form-group">
|
|
<label for="name">Name</label>
|
|
<input type="text" id="name" name="name" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="email">Email</label>
|
|
<input type="email" id="email" name="email" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="subject">Subject</label>
|
|
<input type="text" id="subject" name="subject" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="message">Message</label>
|
|
<textarea id="message" name="message" rows="5" required></textarea>
|
|
</div>
|
|
<button type="submit" class="btn-submit">Send Message</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<style>
|
|
/* Contact Page Styles */
|
|
.page-hero {
|
|
height: 40vh;
|
|
background: linear-gradient(to top,
|
|
rgba(0, 0, 0, 0.7) 0%,
|
|
rgba(0, 0, 0, 0.4) 30%,
|
|
rgba(0, 0, 0, 0) 100%
|
|
), var(--accent);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
text-align: center;
|
|
margin-bottom: 4rem;
|
|
}
|
|
|
|
.page-hero .hero-content {
|
|
padding: 2rem;
|
|
color: white;
|
|
}
|
|
|
|
.page-hero h1 {
|
|
font-size: 3.5rem;
|
|
margin-bottom: 1rem;
|
|
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
|
|
}
|
|
|
|
.page-hero p {
|
|
font-size: 1.3rem;
|
|
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.contact {
|
|
padding: 4rem 0;
|
|
}
|
|
|
|
.contact-grid {
|
|
display: grid;
|
|
grid-template-columns: 1fr 2fr;
|
|
gap: 4rem;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 0 1rem;
|
|
}
|
|
|
|
.contact-info h2 {
|
|
color: var(--dark);
|
|
font-size: 2rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.info-item {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: 1rem;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.info-item i {
|
|
color: var(--accent);
|
|
font-size: 1.5rem;
|
|
width: 24px;
|
|
text-align: center;
|
|
}
|
|
|
|
.info-item p {
|
|
color: #444;
|
|
font-size: 1.1rem;
|
|
line-height: 1.6;
|
|
margin: 0;
|
|
}
|
|
|
|
.contact-form {
|
|
background: white;
|
|
padding: 2.5rem;
|
|
border-radius: 12px;
|
|
box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.form-group label {
|
|
display: block;
|
|
margin-bottom: 0.5rem;
|
|
color: #333;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.form-group input,
|
|
.form-group textarea {
|
|
width: 100%;
|
|
padding: 0.8rem;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
font-size: 1rem;
|
|
transition: border-color 0.3s ease;
|
|
}
|
|
|
|
.form-group input:focus,
|
|
.form-group textarea:focus {
|
|
border-color: var(--accent);
|
|
outline: none;
|
|
box-shadow: 0 0 0 2px rgba(0, 121, 140, 0.1);
|
|
}
|
|
|
|
.btn-submit {
|
|
background-color: var(--accent);
|
|
color: white;
|
|
border: none;
|
|
padding: 1rem 2rem;
|
|
font-size: 1.1rem;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
transition: background-color 0.3s ease;
|
|
width: 100%;
|
|
}
|
|
|
|
.btn-submit:hover {
|
|
background-color: var(--accent-dark);
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.contact-grid {
|
|
grid-template-columns: 1fr;
|
|
gap: 2rem;
|
|
}
|
|
|
|
.page-hero h1 {
|
|
font-size: 2.5rem;
|
|
}
|
|
|
|
.page-hero p {
|
|
font-size: 1.1rem;
|
|
}
|
|
|
|
.contact-info h2 {
|
|
font-size: 1.8rem;
|
|
}
|
|
|
|
.contact-form {
|
|
padding: 1.5rem;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
document.getElementById('contact-form').addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
|
|
// Prikaži indikator nalaganja
|
|
const submitBtn = this.querySelector('.btn-submit');
|
|
const originalBtnText = submitBtn.textContent;
|
|
submitBtn.textContent = 'Sending...';
|
|
submitBtn.disabled = true;
|
|
|
|
// Pridobi podatke iz obrazca
|
|
const formData = new FormData(this);
|
|
formData.append('security', document.querySelector('#contact_security').value);
|
|
|
|
console.log('Sending contact form data to AJAX endpoint...');
|
|
|
|
// Pošlji AJAX zahtevek
|
|
fetch(<?php echo json_encode(admin_url('admin-ajax.php')); ?>, {
|
|
method: 'POST',
|
|
body: formData
|
|
})
|
|
.then(response => {
|
|
console.log('Response status:', response.status);
|
|
if (!response.ok) {
|
|
throw new Error('Network response was not ok: ' + response.status);
|
|
}
|
|
return response.json();
|
|
})
|
|
.then(data => {
|
|
console.log('Response data:', data);
|
|
|
|
// Ponastavi gumb
|
|
submitBtn.textContent = originalBtnText;
|
|
submitBtn.disabled = false;
|
|
|
|
if (data.success) {
|
|
// Uspešno poslano
|
|
alert(data.data);
|
|
this.reset();
|
|
} else {
|
|
// Napaka
|
|
console.error('Form submission error:', data);
|
|
alert(data.data || 'There was an error sending your message. Please try again.');
|
|
}
|
|
})
|
|
.catch(error => {
|
|
// Ponastavi gumb
|
|
submitBtn.textContent = originalBtnText;
|
|
submitBtn.disabled = false;
|
|
|
|
console.error('Error during form submission:', error);
|
|
alert('There was an error sending your message: ' + error.message);
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<?php get_footer(); ?>
|