WordPress & Google Map Shows Blank

I recently copied some code from an existing site and pasted it into a WordPress site and ended up with a simple problem. Everything works but the WordPress template style was stuffing up the display of the map. The div was there, it was just blank.

Feel free to use my code below but you will need to use your own Latitude, Longitude, image, and you also need your own Google Maps API Key.

<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=putyourkeyhere"></script>
<div id="map" style="width: 600px; height: 400px;"></div>
<script type="text/javascript">// <![CDATA[
    function load() {
        if (GBrowserIsCompatible()) {
            var map = new GMap2(document.getElementById('map'));
            map.addControl(new GSmallMapControl());
            map.addControl(new GMapTypeControl());
            map.setCenter(new GLatLng(-33.885892, 151.211724), 12);
        }
        var point = new GLatLng(-33.885892, 151.211724);
        var icon = new GIcon();
        icon.image = 'pointer.png';
        icon.iconSize = new GSize(55, 24);
        icon.iconAnchor = new GPoint(0, 24);
        icon.infoWindowAnchor = new GPoint(0, 0);
        var markerOptions = { icon: icon, draggable: false };
        var marker = new GMarker(point, markerOptions);
        var html = '<b>Hello World!<b>';
        GEvent.addListener(marker, 'click', function () {
            marker.openInfoWindowHtml(html);
        });
        map.addOverlay(marker);
    }
    load();
//!
// ]]&gt;</script>

If you get the map frame showing empty, you need to modify your css file in WordPress. Its location for me was root//wp-content/themes/twentyeleven/style.css

Open the file and remove the following style on line 838:

.entry-content img,
.comment-content img,
.widget img {
	max-width: 97.5%; /* Fluid images for posts, comments, and widgets
}

That should do it!

WordPress Home Page with One Post

Some of my posts are quite long so I decided I wanted to change my home page to display only one post rather than many. This made my home page look a bit neater and not so long.

In order to do this I simply logged in to my WordPress control centre and from the left hand side selected Appearance >> Editior.

From here view the left side and choose the index.php file.

At the very top of that file change the code from:
<?php get_header(); ?>

to:
<?php get_header(); query_posts($query_string.’&posts_per_page=1′); ?>

VOILA! One post per page.

Good Luck.

Installing WordPress on GoDaddy

Since moving in to the Protein Studios and finishing off my last big project, work has considerably slowed for the Christmas and New Year period. I imagine most folks are putting off anything big until Jan of 2012. Therefore, I’ve decided to give WordPress a test drive.

I’ve had some experience with DotNetNuke and have reinvented the wheel with my work with Mitsubishi and World Blue (building my own content managers) but I’m always up for a challenge and I had three reasons to give it a go.

Although he hasn’t asked my opinion, my old business partner is currently looking at alternatives for content management. He currently useses a mix of the CMS I built for him in-house and his brother uses FrontPage for a few of his older sites. As his brother is moving on, he needs a way to manage mostly static content so I thought WordPress might be a good option.

Second, I’ve had a couple of chats with the guys at Protein and they have mentioned they always have WordPress work they can pass my way. I’m not counting my chickens yet, but it would be fun to do a few projects with them.

Finally, as I needed to update my website and there are so many built in ‘widgets’   for WordPress, I thought I’d rebuild it using a new technology. Real projects that will actually be used are always more interesting.

Below are my thoughts on the process.

Installing WordPress

Setup was a breeze as I’ve got my account hosted with GoDaddy.

Login to your GoDaddy account. Click on ‘Hosting & Servers’ then select Hosting Management at the bottom. If you have already purchased hosting with GoDaddy you should see the option to launch the control centre.
Launch Control Centre

Once you have launched the control centre, select the Hosting Connection under the ‘Content’ menu.
Hosting Connection

There you should see a list of content managers such as Joomla, WordPress and others with feedback and ratings for each. Select WordPress.

Select WordPress

The next page should allow you the option to install WordPress.
Install WordPress

I was given the option of where to install (I chose the root) and allowed to designate the username and password for administration of the site.

The install process then took around 15 minutes. I’m assuming it has some sort of manual process involved hence the delay. Once completed, I received an email saying it was ready to go. Completely painless so far!

Administering WordPress

If your DNS settings are already pointing to the GoDaddy hosting account then you should be able to navigate to your site and VOILA! There is a blogsite there with temporary info and the typical ‘Hello World’ post (with a test reply). Nice.

To administer your site, go to the login screen by typing in your domain and then /wp-login.php. For example http://www.greenbilling.com/wp-login.php. (This is where you use the username and password you designated in the step above.)
Login

 

 

 

 

 

 

 

 

 

Wow, that was pretty easy. I’ll play around with adminstration and get the site setup. If I find any tricks or tips I’ll post them. Good luck with your install.