ik heb voor ieder pagina van my website eigen php pagina gemaakt om verschillende header images te gebruiken. nu ik probeer google map api in mij contact pagina te verplaatsen maar dingen gaat fout.
als ik het code op deze manier doen:
<?php
/**
* The template for displaying the footer.
*
* Contains the closing of the #content div and all content after.
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package Garage
*/
?>
</div><!-- #content -->
<div id="map"> </div>
<script>
function initMap() {
// Create a new StyledMapType object, passing it an array of styles,
// and the name to be displayed on the map type control.
var styledMapType = new google.maps.StyledMapType(
[
{elementType: 'geometry', stylers: [{color: '#ebe3cd'}]},
{elementType: 'labels.text.fill', stylers: [{color: '#523735'}]},
{elementType: 'labels.text.stroke', stylers: [{color: '#f5f1e6'}]},
{
featureType: 'administrative',
elementType: 'geometry.stroke',
stylers: [{color: '#c9b2a6'}]
},
{
featureType: 'administrative.land_parcel',
elementType: 'geometry.stroke',
stylers: [{color: '#dcd2be'}]
},
{
featureType: 'administrative.land_parcel',
elementType: 'labels.text.fill',
stylers: [{color: '#ae9e90'}]
},
{
featureType: 'landscape.natural',
elementType: 'geometry',
stylers: [{color: '#dfd2ae'}]
},
{
featureType: 'poi',
elementType: 'geometry',
stylers: [{color: '#dfd2ae'}]
},
{
featureType: 'poi',
elementType: 'labels.text.fill',
stylers: [{color: '#93817c'}]
},
{
featureType: 'poi.park',
elementType: 'geometry.fill',
stylers: [{color: '#a5b076'}]
},
{
featureType: 'poi.park',
elementType: 'labels.text.fill',
stylers: [{color: '#447530'}]
},
{
featureType: 'road',
elementType: 'geometry',
stylers: [{color: '#f5f1e6'}]
},
{
featureType: 'road.arterial',
elementType: 'geometry',
stylers: [{color: '#fdfcf8'}]
},
{
featureType: 'road.highway',
elementType: 'geometry',
stylers: [{color: '#f8c967'}]
},
{
featureType: 'road.highway',
elementType: 'geometry.stroke',
stylers: [{color: '#e9bc62'}]
},
{
featureType: 'road.highway.controlled_access',
elementType: 'geometry',
stylers: [{color: '#e98d58'}]
},
{
featureType: 'road.highway.controlled_access',
elementType: 'geometry.stroke',
stylers: [{color: '#db8555'}]
},
{
featureType: 'road.local',
elementType: 'labels.text.fill',
stylers: [{color: '#806b63'}]
},
{
featureType: 'transit.line',
elementType: 'geometry',
stylers: [{color: '#dfd2ae'}]
},
{
featureType: 'transit.line',
elementType: 'labels.text.fill',
stylers: [{color: '#8f7d77'}]
},
{
featureType: 'transit.line',
elementType: 'labels.text.stroke',
stylers: [{color: '#ebe3cd'}]
},
{
featureType: 'transit.station',
elementType: 'geometry',
stylers: [{color: '#dfd2ae'}]
},
{
featureType: 'water',
elementType: 'geometry.fill',
stylers: [{color: '#b9d3c2'}]
},
{
featureType: 'water',
elementType: 'labels.text.fill',
stylers: [{color: '#92998d'}]
}
],
{name: 'Styled Map'});
// Create a map object, and include the MapTypeId to add
// to the map type control.
var map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 51.865, lng: .345},
zoom: 11,
mapTypeControlOptions: {
mapTypeIds: ['roadmap', 'satellite', 'hybrid', 'terrain',
'styled_map']
}
});
//Associate the styled map with the MapTypeId and set it to display.
map.mapTypes.set('styled_map', styledMapType);
map.setMapTypeId('styled_map');
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCcVLAHwD3F94QxDROJJP_R7Q50QXV4mI0&callback=initMap">
</script>
<div class="site-footer">
<div class="expanded row">
<div class="site-footer-section1 small-4 column">Je krijgt altijd vooraf een</br>
prijsopgave, dus geen verrassingen</br>
achteraf. </div> </div>
<div class="expanded row">
<div class="site-footer-section2 small-4 small-push-4 column">Gecertificeerde eerste monteur</br>
Keurmeester(25 jaar ervaring) </div> </div>
<div class="expanded row">
<div class="site-footer-section3 small-4 small-push-9 column"> David's Apk Station </br>
Klompenmakerstraat 123</br>
3194 DD Hoogvliet RT</br>
010-2160660 </div> </div>
<div class="expanded row">
<div class="site-footer-section3C small-4 small-push-8 column"> Email:[email protected] </div> </div>
</div>
</div>
<div class="site-info">
<div class="expanded row">
<div class="site-info-section1 small-4 column"> <?php
echo do_shortcode('[smartslider3 slider=286]');
?> </div> </div>
<div class="expanded row">
<div class="site-info-section2 small-4 small-push-5 column">40 jaar vaak ervaring </div> </div>
<div class="expanded row">
<div class="site-info-section3 small-4 small-push-9 column">BMW Specialist(25 jaar ervaring)</div> </div>
</div><!-- .site-info -->
<script>
function _(id) { return document.getelementById(id) ; }
function submitform() {
_("mybtn") .disabled = true;
_("status") .innerHTML = 'please wait ...' ;
var formdata = new FormData () ;
formdata.append( "n", _("n") .value );
formdata.append( "e", _("e") .value );
formdata.append( "t", _("t") .value );
formdata.append( "o", _("o") .value );
formdata.append( "m", _("m") .value );
var ajax =new XMLHttprequest () ;
ajax.open( "POST", "example_parser.php" );
ajax.onreadystatechange = function() {
if (ajax.readyState == 4 && ajax.status == 200) {
if(ajax.responseText =="success") {
_("my_form") .innerHTML = '<h2>Thanks '+_("n") .value+', your message has been sent.</h2>';
} else {
_("status") .innerHTML =ajax.responseText;
_("mybtn") .disabled =false;
}
}
}
ajax.send( formdata );
}
</script>
</div><!-- #page -->
<?php wp_footer(); ?>
</body>
</html>
dan u kunt zien op deze url:http://webdesignleren.net/contact/
dat de map is zichtbaar maar ik kan hem niet omhoog of onder contactform image krijgen omdat ik denk dat:
<div id="map"> </div>
is niet onder image classs is verplaatst in contact pagina.
maar als ik ID map code als volgende in contact.php verplaats:
<?php
/*
Template Name: contact
*/
if(is_page(43)) {
get_header('contact');
}
else {
get_header();
}
wp_head(); ?>
<div class="expanded row">
<div id="primary" class="content-area">
<div class="expanded row">
<main id="main" class="site-main">
<div class="small-8 column">
<div class="expanded row">
<div class="contact-form-tekst small-4 column">Neem contact met ons op </div> </div>
<div class="expanded row">
<div class="contact-form">
<?php
$image_url='http://webdesignleren.net/wp-content/uploads/2017/03/contact-form-background-800-600.jpg';
?>
<img src="<?php echo $image_url;?>">
<div class="expanded row">
<div class="contact-formT">Contactformulier</div> </div>
<div class="expanded row">
<div class="contact-formE small-12-column">
<form id="my_form" onsubmit="submitForm(); return false;">
<p><input id="n" placeholder="Naam" required></p>
<p><input id="e" placeholder="Email Address" type="email" required></p>
<p><input id="t" placeholder="telefoon" ></p>
<p><input id="o" placeholder="Onderwerp" required></p>
<textarea id="m" placeholder="Uw bericht" rows="12" required></textarea>
<p><input id="mybtn" type="submit" value="Submit Form"> <span id="status"></span></p>
</form>
</div></div>
</div></div>
<div class="expanded row">
<div class="google-map" id="map"> </div></div>
</div>
<div class="small-4 column">
<div class="expanded row">
<div class="aside1-header-tekst small-12 column">Adres en contactgegevens</div> </div>
<div class="section-aside1">
<div class="expanded row">
<div class="subaside1 small-4 column">
<?php
echo do_shortcode('[smartslider3 slider=140]');
?>
</div>
<div class="subaside1-section2 small-8 column">
David's APK Station</br>
Klompenmakerstraat 123</br>
3194 DD Hoogvliet RT
</div>
</div>
<div class="expanded row">
<div class="subaside2 small-2 column">
<?php
echo do_shortcode('[smartslider3 slider=141]');
?>
</div>
<div class="subaside2-section2 small-8 small-pull-2 column">010-XXXXXX </div>
</div>
<div class="expanded row">
<div class="subaside3 small-2 column"><?php
echo do_shortcode('[smartslider3 slider=142]');
?> </div>
<div class="subaside3-section2 small-8 small-pull-2 column">>Plan route </div>
</div>
<div class="expanded row">
<div class="subaside4 small-10 column"> </div>
</div>
<div class="expanded row">
<div class="subaside5 small-12 column">Openingstijden David's APK Station Hoogvliet</div>
</div>
<div class="expanded row">
<div class="subaside6 small-4 column">
<table>
<tbody>
<tr>
<td>
Maandag
Dinsdag
Woensdag
Donderdag
Vrijdag
Zaterdag
Zondag
</td>
</tr>
</tbody>
</table>
</div>
<div class="subaside6-section2 small-6 small-pull-2 column">
<table>
<tbody>
<tr>
<td>08.00 - 18.00 uur
08.00 - 18.00 uur
08.00 - 18.00 uur
08.00 - 18.00 uur
08.00 - 18.00 uur
08.00 - 13.00 uur
Gesloten</td>
</tr>
</tbody>
</table>
</div>
</div>
</div><!-- end van aside1 -->
<div class="expanded row">
<div class="aside2-header-tekst small-12 column">Klantboordeling</div>
</div>
<div class="section-aside2">
<div class="expanded row">
<div class="KB-section1 small-7 column"><?php
echo do_shortcode('[smartslider3 slider=145]');
?> </div>
<div class="KB-section2 small-5 column"></div>
</div> </div>
<div class="expanded row">
<div class="aside4-header-tekst small-12 column">Facebook David's APK Station</div> </div>
<div class="section-aside4">
<div class="expanded row">
<div class="Facebook-section1 small-6 column"><?php
echo do_shortcode('[smartslider3 slider=146]');
?> </div>
<div class="Facebook-section2 small-6 column">> Volg ons op Facebook</div>
</div> </div>
<div class="expanded row">
<div class="aside5-header-tekst small-12 column">Twitter David's APK Station</div> </div>
<div class="section-aside5">
<div class="expanded row">
<div class="Twitter-section1 small-6 column"><?php
echo do_shortcode('[smartslider3 slider=147]');
?></div>
<div class="Twitter-section2 small-6 column">> Volg ons op Twitter</div>
</div>
</div>
</div>
</div>
</main>
</div>
</div> </div>
<?php get_template_part('template-parts/content', 'page' );
?>
<?php
if( isset($_POST['n']) && isset($_POST['E']) && isset($_POST['t']) && isset($_POST['o']) && isset($_POST['M'] ) ) {
$n = $_POST['n'];
$e = $_POST['e'];
$t =$_POST['t'];
$o =$_POST['o'];
$m =nl2br($_POST['m'] );
$to ="[email protected]";
$from = $e;
$subject = 'Contact Form Message';
$headers = "From: $from\n";
$headers .="MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
if(mail($to, $subject, $message, $headers) ) {
echo "success";
} else {
echo "The server Failed to sent the message. Please try again later.";
}
}
?>
<?php
if(is_page(43)) {
get_footer('contact');
}
else {
get_footer();
}
wp_footer(); ?>
dan verdwijnt google map van contact pagina. ik begrijp niet waarom?
ik werk met foundation grid system ,ik heb van alles geprobeerd om de probleem oplossen maar zonder resultaat.
eigenlijk hoort deze code:
<div id="map"> </div>
in contact pagina te zijn onder contact form class.
wat ik doe fout ?
ik heb alles volgens documentation van google gemaakt met API key en lang ING nummers.
dank u wel
johannes