Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDemian Arend
3,386 PointsMy Google Maps map won't center in WordPress
I just set up a WordPress site and embedded a Google map in a Location page, everything worked, except that it won't center. It stays aligned left no matter what I do. I've gone in and checked the code but can't see anything wrong. I've noticed WP can be glitchy and has a delayed reaction in registering changes sometimes. Maybe it's this.
Here's the code. WordPress has changed the Google Maps iframe code to a shorthand code. And, oh yeah, everything else is centering just fine. Anybody have any ideas?
<img class="alignnone size-medium wp-image-53 aligncenter" src="https://bibelotsblog.files.wordpress.com/2016/11/oddsandendsfresco12lessstrtn.png?w=300" alt="oddsandendsfresco12lessstrtn" width="300" height="171" /> <p style="text-align: center;"><em>Bibelots (Little Treasures)</em></p> <p style="text-align: center;">at <em>A Little Bit of This, A Little Bit of That</em>, antique mall</p>
<div style="text-align: center;"><span class="_50f4">510 Portland Rd. Bridgeton, ME</span></div> <div></div> <p style="text-align: center;">[googlemaps https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2869.02079757992!2d-70.68933938584873!3d44.020964736591836!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x4cb253f9be7db5b1%3A0x3b3866171c3cf581!2s510+Portland+Rd%2C+Bridgton%2C+ME+04009!5e0!3m2!1sen!2sus!4v1479338479579&w=300&h=200]</p>
2 Answers
Jonny Noble
11,165 PointsAre you using anyJavascript for the google map? The marker is usually ventured through Js.
There is a plug in for WordPress called Advanced Custon Fields which is what we use at work on a daily basis. There's some handy info on there for the google maps.
Demian Arend
3,386 PointsOh, thanks for that info. I ended up just taking a screen shot of the map and putting that in, which centered correctly. But, of course, I'd rather have the working Google map link. I'll definitely take a look at the plug in you mention.