8 posts / 0 new
Last post
StatSilk's picture
setting up StatPlanet in wordpress


Dear all

I am trying to set up two different StatPlanet Plus maps on the same website domain, under a wordpress install.

After searching these forums I found that you need to add the following to the header to direct each page to the appropriate StatPlanet install. However I am unsure how to set this up correctly as I am encountering errors.

What I am trying to do:

I have two StatPlanet Plus maps of the UK (one at "county" level and one at "local authority" level (a smaller level of geography)). I want one map to go on the page "CountyMap" and the other to go on the page "LocalAuthorityMap".

What I have done:

1. In "uploads" added the folders "StatPlanet" for Local Authority StatPlanet maps & data and "StatPlanetCounty" for County-level StatPlanet maps and data.

2. Added the following lines to my header.php:

if ($page_title == 'LocalAuthorityMaps'): <base href="/wp-content/uploads/statplanet/" /> endif;

if ($page_title == 'CountyMaps'): <base href="/wp-content/uploads/statplanetcounty/" /> endif;

What the problem is:

Adding this to the header.php file does not seem to work.

I have tried adding it (as is) directly before the </head> tag but it does not get parsed correctly, the website simply reads it as text, the rest of the web pages' content (i.e. text) appears as normal but the maps do not load.

I have also tried adding this before the </head> tag but enclosed by <?php and  ?> tags but then the webpages do not load at all (no text or maps).

Any help on this issue would be greatly appreciated.




StatSilk's picture

Hi James,

Have you tried using the WordPress plugin as described here?




Yes, I have been using that plugin with success on a single statplanet instance until now. i.e.

[kml_flashembed publishmethod="static" fversion="8.0.0" useexpressinstall="true" movie="StatPlanet.swf" width="950" height="712" targetclass="flashmovie"]

It's trying to add the second instance "statplanetcounty" where this seems not to work. I think I need help in setting up the "if" command in the header.php file.

StatSilk's picture

Hi James,

Perhaps you could try the following. If it still doesn't work, it would be useful if you could e-mail the header.php file. Many thanks.

if ($page_title == 'LocalAuthorityMaps') {
echo '<base href="/wp-content/uploads/statplanet/" />';
} elseif ($page_title == 'CountyMaps') {
echo '<base href="/wp-content/uploads/statplanetcounty/" />';

Hi Frank

Thanks for your help on this one. I found the fix. Firstly, I eventually realised I had already called a php script into the <head> tags, but rather than directly editing header.php I had been using a different wordpress plugin to do this (Genesis Simple Hooks).

Once I found this, I tried changing the php to what you suggested above, and to the format documented at http://www.statsilk.com/support/faq#wordpress but still no luck.

So, I simply duplicated my old code (which was working on one page) to work for a second page, pointing to a different URL. For anyone who has future difficulty installing more than one Statplanet Plus map on their website the following code, placed in the header.php file, worked for me:

if (is_page(1))
echo '<base href="/wp-content/uploads/statplanet/">';

if (is_page(2))
echo '<base href="/wp-content/uploads/statplanetcounty/">';

where you should replace page IDs "1" and "2" with the wordpress page ID number of your pages.

StatSilk's picture

Hi James,

Thanks very much for sharing the solution and glad to hear you resolved it. That is really helpful. I will update the FAQ.



nice post...

Hi Frank,
The link of WordPress plugin you have given is terrific. Thanks for recommendation; it was helpful to me as well. Apart from this, James and your conversation itself have cleared my confusion about adding the second instance before I ask. Thanks a lot guys, I would further ask if any other doubt thrives my mind.