Commit 1ac36cc5 authored by agnez's avatar agnez

contact form gasap WIP

parent 5cc99b78
......@@ -185,8 +185,7 @@ main .uk-container{
}
}
#snippet_la_carte{
height: 200px;
background-color: gold;
}
#gasap-footer{
......
<p>obselethe</p>
<?php
//test https://premium.wpmudev.org/blog/how-to-build-your-own-wordpress-contact-form-and-why/?utm_expid=3606929-94.Ie3dH-CaRwe6MU3VrZsdvw.0
......@@ -15,8 +17,8 @@
}
//response messages
$not_human = "Human verification incorrect.";
$missing_content = "Please supply all information.";
$not_human = 'Human verification incorrect.';
$missing_content = 'Please supply all information.';
$email_invalid = "Email Address Invalid.";
$message_unsent = "Message was not sent. Try Again.";
$message_sent = "Thanks! Your message has been sent.";
......@@ -26,7 +28,7 @@
$email = $_POST['message_email'];
$message = $_POST['message_text'];
$human = $_POST['message_human'];
$body = 'Name:' .$name. '\n\nEmail:' .$email. '\n\nComments: \n' .$message. ';
$body = 'Name:' .$name. '\n\nEmail:' .$email. '\n\nComments: \n' .$message;
//php mailer variables
$to = get_option('admin_email');
......@@ -57,7 +59,6 @@
}
}
else if ($_POST['submitted']) gasap_contact_form_generate_response("error", $missing_content);
?>
<div id="respond">
......
<section id="snippet_la_carte" class="uk-grid">
<div class="uk-width-1-1 uk-width-medium-2-3">
<h2>Trouvez un GASAP près de chez vous !</h2>
<div>TODO</div>
<section id="snippet_la_carte">
<div class="uk-grid">
<div class="uk-width-1-1 uk-width-medium-2-3">
<h2>Trouvez un GASAP près de chez vous !</h2><?php
$gasap = new WP_Query( array(
'post_type' => 'gasap',
'order_by' => 'title'
)); ?>
<div class="uk-grid"><?php
if($gasap->have_posts()){ ?>
<div class="uk-width-1-1 uk-width-medium-1-3">
<ul data-uk-switcher="{connect:'#les_gasap', animation: 'fade'}"> <?php
while ( $gasap->have_posts() ) : $gasap->the_post();
global $post; ?>
<li><a><?php echo get_the_title(); ?></a></li><?php
endwhile; ?>
</ul>
</div> <?php
$gasap->rewind_posts(); ?>
<div class="uk-width-1-1 uk-width-medium-2-3 uk-panel">
<ul id="les_gasap" class="uk-switcher"><?php
while ( $gasap->have_posts() ) : $gasap->the_post();
global $post; ?>
<li id="post-<?php the_ID(); ?>">
<h3><?php echo get_the_title(); ?></h3>
<?php the_content() ?>
<?php edit_post_link( esc_html__( 'Edit gasap', 'beans_gasap' ), '<span class="edit-link">', '</span>' ); ?>
</li><?php
endwhile;?>
</ul>
</div><?php
}?>
</div>
</div>
<div class="uk-width-1-1 uk-width-medium-1-3">
MAP here
</div>
</div>
<div class="uk-width-1-1 uk-width-medium-1-3">
MAP here
</div>
</section>
\ No newline at end of file
</section><?php
\ No newline at end of file
......@@ -11,7 +11,7 @@
'post__not_in' => array( $active_prod )
));
?><div class="uk-grid"><?php
?><div class="uk-grid"><?php
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="uk-width-1 uk-width-medium-1-2"><?php
......@@ -23,7 +23,7 @@
</div>
<?php $do_not_duplicate[] = get_the_ID();
endwhile;
?></div><?php
?></div><?php
if(get_query_var($active_prod) !== '') {
$loop2 = new WP_Query( array( 'p' => $active_prod) );
......@@ -36,7 +36,6 @@ if(get_query_var($active_prod) !== '') {
));
}
while ( $loop2->have_posts() ) : $loop2->the_post();
?>
<div id="presentation_producteur" class="uk-block">
......
......@@ -17,6 +17,7 @@ function gasap_enqueue_uikit_assets() {
// Enqueue uikit overwrite theme folder
//beans_uikit_enqueue_theme( 'beans_gasap', get_stylesheet_directory_uri() . '/assets/less/uikit' );
// Add the theme style as a uikit fragment to have access to all the variables
beans_uikit_enqueue_components( array( 'switcher' ) );
beans_uikit_enqueue_components( array( 'slider', 'slideshow' ), 'add-ons' );
beans_compiler_add_fragment( 'uikit', get_stylesheet_directory_uri() . '/assets/less/style.less', 'less' );
beans_compiler_add_fragment( 'uikit', get_stylesheet_directory_uri() . '/assets/less/gasap.less', 'less' );
......@@ -25,8 +26,8 @@ function gasap_enqueue_uikit_assets() {
}
// Remove this action and callback function if you are not adding CSS in the style.css file.
//add_action( 'wp_enqueue_scripts', 'beans_child_enqueue_assets' );
//function beans_child_enqueue_assets() {
// add_action( 'wp_enqueue_scripts', 'beans_child_enqueue_assets' );
// function beans_child_enqueue_assets() {
// wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css' );
//}
......@@ -64,4 +65,26 @@ add_filter( 'query_vars', 'gasap_prodlink_add_custom_query_var' );
function gasap_prodlink_add_custom_query_var( $vars ){
$vars[] = "choix_prod"; //pour template part three_producers
return $vars;
}
//TEST
/*
* Usage: in contact form 7 form area add
* [author_email unique_name]
* and in to email address add
* [unique_name]
*/
//contact form 7 author email
wpcf7_add_form_tag('author_email', 'wpcf7_expert_email_shortcode_handler', true);
function wpcf7_expert_email_shortcode_handler($tag) {
if (!is_array($tag)) return '';
$name = $tag['name'];
if (empty($name)) return '';
global $post;
//get author email:
$author_mail = get_the_author_meta('user_email',$post->post_author);
$html = '<input type="hidden" name="' . $name . '" value="' . $author_mail . '" />';
return $html;
}
\ No newline at end of file
......@@ -2,7 +2,11 @@
add_action( 'beans_post_after_markup', 'add_after_gasapsingle' );
function add_after_gasapsingle() {
include (get_stylesheet_directory() . '/assets/template_parts/form_contact_gasap.php');
// include (get_stylesheet_directory() . '/assets/template_parts/form_contact_gasap.php');
global $post;
$author_mail = get_the_author_meta('user_email',$post->post_author);
echo do_shortcode('[contact-form subject="message from.'$post->post_title.'" to="'.$author_mail.'"]');
include (get_stylesheet_directory() . '/assets/template_parts/footer.php');
}
// Load the document which is always needed at the bottom of template files.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment