You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.8 KiB

<?php
/**
* Block: Contact Form
*
* @package Nenghui Energy Theme
*/
// 防止直接访问
if (!defined('ABSPATH')) {
exit;
}
// 获取短代码参数或使用默认值
global $contact_form_shortcode_atts;
$atts = $contact_form_shortcode_atts ?? array();
// 设置默认值
$container_id = $atts['id'] ?? 'contact-form-container';
$container_class = 'contact-form-container';
if (!empty($atts['class'])) {
$container_class .= ' ' . esc_attr($atts['class']);
}
$form_id = $atts['form_id'] ?? '1';
$show_animation = $atts['show_animation'] ?? 'true';
?>
<div id="<?php echo esc_attr($container_id); ?>" class="<?php echo esc_attr($container_class); ?>"<?php if ($show_animation === 'true'): ?> data-aos="fade-up"<?php endif; ?>>
<div class="contact-form"><?php echo do_shortcode('[fluentform id="' . esc_attr($form_id) . '"]'); ?></div>
</div>
<style>
.contact-form-container {
max-width: 100%;
margin: 0 auto;
background-image: url('<?php echo get_template_directory_uri(); ?>/assets/images/contact-bg.webp');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
padding: 30px;
border-radius: 8px;
height: 600px;
}
.contact-form-container.aos-animate {
opacity: 1;
transform: translateY(0);
}
.contact-form {
width: 50%;
height: auto;
margin: 0 auto;
position: relative;
top: 50%;
transform: translateY(-50%);
}
@media screen and (max-width: 768px) {
.contact-form {
width: 100%;
top: auto;
transform: none;
}
.contact-form-container {
height: auto;
padding: 40px 20px;
}
}
</style>