Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

WP Geo with custom post type WordPress

  • SOLVED

Hello

I'm working on a travel site for a customer and need to use the wp geo plugin to add Google maps to the travel destinations. The travel destinations are added using a custom post type called destination. There is a custom single post template showing a special layout for this post type as well.

I can't get the map to display at all. I need help with what php template tag I need to use in my custom single template and any other setup.

I can view and choose the location in the travel destinations without problems.
Thanks in advance.

Answers (3)

2011-09-26

Abdessamad Idrissi answers:

try this:
<?php if ( isset($wpgeo) ) $wpgeo->categoryMap(); ?>


Abdessamad Idrissi comments:

check this out too:
http://www.wpgeo.com/documentation/template-tags


René Sejling comments:

No luck


Abdessamad Idrissi comments:

note that you must put it inside the loop:
if(have_posts()) : while(have_posts()): the_post() ;


René Sejling comments:

Check above attached file, that code is there.
It works on the regular posts, just not the custom post type I have called destination.


René Sejling comments:

http://www.renesejling.dk/sites/horisontrejser/?p=527
Regular post, works.


Abdessamad Idrissi comments:

did u enable it for custom post type? put this in your functions.php:
// add custom posts types support for WP Geo
add_post_type_support( 'destination', 'wpgeo' );


check also wp Geo settings and enable it there.


René Sejling comments:

I did that yes.
I can easily select the location in the post etc, but nothing displays on the post itself.


Abdessamad Idrissi comments:

if u can create a temporary account and pm me the details, I'll help solve this :)

2011-09-26

Fahad Murtaza answers:

You simply need

<?php if ( function_exists( 'wpgeo_post_map' ) ) wpgeo_post_map(); ?>

in your single template.


René Sejling comments:

I already tried that, no luck.
You can check the page here. If you check the html code, the map is added but nothing is displayed, and I'm unsure if this has something todo with the custom template or whatever it might be.

http://www.renesejling.dk/sites/horisontrejser/?destination=bhutan-bhu1178
(danish language, map should be displayed below the body text)

Custom template is attached.
I'm using Thesis 1.8.2. Wordpress 3.2.1