Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(get_post_type($post) == 'sejour-gastronomique'){
- //Page est de type "sejour-gastronomique"
- echo '<h1>';
- the_title();
- echo '<hr></h1>';
- the_content('');
- //Tableaux des séjours gastronomiques
- if (ICL_LANGUAGE_CODE == 'fr') { echo "<h4>Tarifs</h4>";} if (ICL_LANGUAGE_CODE == 'nl') { echo "<h4>Prijzen</h4>";} if (ICL_LANGUAGE_CODE == 'en') { echo "<h4>Price</h4>";}
- echo '<table>';
- echo '<tr><td>';
- if (ICL_LANGUAGE_CODE == 'fr') { echo "Type de chambre ";}
- if (ICL_LANGUAGE_CODE == 'nl') { echo "Kamers ";}
- if (ICL_LANGUAGE_CODE == 'en') { echo "Type of room";}
- echo'</td><td>';
- if (ICL_LANGUAGE_CODE == 'fr') { echo "1 personne ";}
- if (ICL_LANGUAGE_CODE == 'nl') { echo "1 personne";}
- if (ICL_LANGUAGE_CODE == 'en') { echo "1 personne";}
- echo'</td><td>';
- if (ICL_LANGUAGE_CODE == 'fr') { echo "2 personnes ";}
- if (ICL_LANGUAGE_CODE == 'nl') { echo "2 personnes ";}
- if (ICL_LANGUAGE_CODE == 'en') { echo "2 personnes";}
- echo'</td></tr>';
- //Cible de l'action des formulaires
- if (ICL_LANGUAGE_CODE == 'fr') {
- $action = '/votre-reservation';
- }
- if (ICL_LANGUAGE_CODE == 'nl') {
- $action = get_bloginfo('url').'uw-boeking';
- }
- if (ICL_LANGUAGE_CODE == 'en') {
- $action = get_bloginfo('url').'your-booking';
- }
- //New Solution
- $post_en_cours = get_the_ID();
- $sejourgastro = get_the_title();
- $idproduitsejour = get_field("idproduit");
- $nuitspayantes = get_field("nuitspayantes");
- //Initialisation d'un compteur
- $nombreinitial = 1;
- /* echo $post_en_cours ."<br>";
- echo $sejourgastro ."<br>";
- echo $idproduitsejour ."<br>";
- echo $nuitspayantes ."<br>"; */
- var_dump( get_field('relation_sejour_chambre') );
- $posts = get_field('relation_sejour_chambre');
- if( $posts ): ?>
- <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
- <?php setup_postdata($post); ?>
- <tr>
- <td><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td>
- <?php
- //Si séjour gastro demi-pension
- if ($post_en_cours == '246' or $post_en_cours == '620' or $post_en_cours == '437' ){
- //Mis en place du compteur dans la boucle
- //echo "Le nombreinitial est".$nombreinitial;
- $nombre = $nombreinitial++;
- //echo $nombre;
- echo '<td>'.get_field("sejour_demi_single").' € <a onclick="submitsejour1p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
- echo '<td>'.get_field("sejour_demi_double").' € <a onclick="submitsejour2p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver() .'</a></td>';
- //Formsejour1personne
- echo '<form method="POST" action="'.$action.'" name="formsejour1persN'.$nombre.'">
- <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
- <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
- <input type="hidden" value="'.get_field("sejour_demi_single").'" name="prixsingle">
- <input type="hidden" value="'.get_field("chambre_prix_single_seule").'" name="pc1n">
- <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
- <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
- <input type="hidden" value="'.get_langue().'" name="langue">
- <input type="hidden" value="1" name="quantite">
- </form>';
- //Formsejour2personnes
- echo '<form method="POST" action="'.$action.'" name="formsejour2persN'.$nombre.'">
- <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
- <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
- <input type="hidden" value="'.get_field("sejour_demi_double").'" name="prixdouble">
- <input type="hidden" value="'.get_field("chambre_prix_double_seule").'" name="pc1n">
- <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
- <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
- <input type="hidden" value="'.get_langue().'" name="langue">
- <input type="hidden" value="1" name="quantite">
- </form>';
- }
- //Si séjour gastro 1 nuitée
- if($post_en_cours=='245' or $post_en_cours == '621' or $post_en_cours=='622'){
- $nombre = $nombreinitial++;
- echo '<td>'.get_field("sejour_unenuit_single").' € <a onclick="submitsejour1p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
- echo '<td>'.get_field("sejour_unenuit_double").' € <a onclick="submitsejour2p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
- //Formsejour1personne
- echo '<form method="POST" action="'.$action.'" name="formsejour1persN'.$nombre.'">
- <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
- <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
- <input type="hidden" value="'.get_field("sejour_unenuit_single").'" name="prixsingle">
- <input type="hidden" value="'.get_field("chambre_prix_single_seule").'" name="pc1n">
- <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
- <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
- <input type="hidden" value="'.get_langue().'" name="langue">
- <input type="hidden" value="1" name="quantite">
- </form>';
- //Formsejour2personnes
- echo '<form method="POST" action="'.$action.'" name="formsejour2persN'.$nombre.'">
- <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
- <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
- <input type="hidden" value="'.get_field("sejour_unenuit_double").'" name="prixdouble">
- <input type="hidden" value="'.get_field("chambre_prix_double_seule").'" name="pc1n">
- <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
- <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
- <input type="hidden" value="'.get_langue().'" name="langue">
- <input type="hidden" value="1" name="quantite">
- </form>';
- }
- //Si séjour gastro 2 nuitées
- if($post_en_cours=='244' or $post_en_cours=='623' or $post_en_cours=='624' ){
- $nombre = $nombreinitial++;
- echo '<td>'.get_field("sejour_deuxnuits_single").' € <a onclick="submitsejour1p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
- echo '<td>'.get_field("sejour_deuxnuits_double").' € <a onclick="submitsejour2p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
- //Formsejour1personne
- echo '<form method="POST" action="'.$action.'" name="formsejour1persN'.$nombre.'">
- <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
- <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
- <input type="hidden" value="'.get_field("sejour_deuxnuits_single").'" name="prixsingle">
- <input type="hidden" value="'.get_field("chambre_prix_single_seule").'" name="pc1n">
- <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
- <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
- <input type="hidden" value="'.get_langue().'" name="langue">
- <input type="hidden" value="1" name="quantite">
- </form>';
- //Formsejour2personnes
- echo '<form method="POST" action="'.$action.'" name="formsejour2persN'.$nombre.'">
- <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
- <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
- <input type="hidden" value="'.get_field("sejour_deuxnuits_double").'" name="prixdouble">
- <input type="hidden" value="'.get_field("chambre_prix_double_seule").'" name="pc1n">
- <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
- <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
- <input type="hidden" value="'.get_langue().'" name="langue">
- <input type="hidden" value="1" name="quantite">
- </form>';
- }
- //Si séjour gastro mi-semaine
- if($post_en_cours=='274' or $post_en_cours=='617' or $post_en_cours=='618' ){
- $nombre = $nombreinitial++;
- echo '<td>'.get_field("sejour_misemaine_single").' € <a onclick="submitsejour1p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
- echo '<td>'.get_field("sejour_misemaine_double").' € <a onclick="submitsejour1p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
- //Formsejour1personne
- echo '<form method="POST" action="'.$action.'" name="formsejour1persN'.$nombre.'">
- <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
- <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
- <input type="hidden" value="'.get_field("sejour_misemaine_single").'" name="prixsingle">
- <input type="hidden" value="'.get_field("chambre_prix_single_seule").'" name="pc1n">
- <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
- <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
- <input type="hidden" value="'.get_langue().'" name="langue">
- <input type="hidden" value="1" name="quantite">
- </form>';
- //Formsejour2personnes
- echo '<form method="POST" action="'.$action.'" name="formsejour2persN'.$nombre.'">
- <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
- <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
- <input type="hidden" value="'.get_field("sejour_misemaine_double").'" name="prixdouble">
- <input type="hidden" value="'.get_field("chambre_prix_double_seule").'" name="pc1n">
- <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
- <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
- <input type="hidden" value="'.get_langue().'" name="langue">
- <input type="hidden" value="1" name="quantite">
- </form>';
- }
- ?>
- </tr>
- <?php endforeach; ?>
- <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
- <?php endif;
- echo '</table>';
- }
- if(get_post_type($post) == 'formule-avantageuse'){
- //Page est de type "formule-avantageuse"
- echo '<h1>';
- the_title();
- echo '<hr></h1>';
- the_content('');
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement