Forums

Geotag
Using Geotag with Themes (9 posts)

  1. palo
    Member
    Posted 2 years ago #

    hi there, can you post a functional example of theme integration?

    thanks

    http://wordpress.org/extend/plugins/geotag/

  2. le soleil
    Member
    Posted 2 years ago #

    Oh, that would be helpful.

    I tried code something for single.php site, but it doesn't work ( post id is 0 div with map id gmap_0_0) and map is showing nothing besides blue.

    <?php
     if (is_single()) {
      $post->ID = get_query_var('p');
      if (class_exists('Geotag')) {
       Geotag::the_geotag('print_map', array('post_id' => ''.$post->ID));
       }
     }
    ?>

    Where am i wrong?

  3. Boris
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,
    to display a simple map with all of your geotagged posts you can try the following code:

    if (class_exists('Geotag')) {
    	$options = array(
    		'width' => '100%',
    		'height' => '400px',
    		'visible' => true,
    		'marker_query' => 'numberposts=-1',
    		'readexiftags' => true,
    		'init_on_pageload' => true
    	);
    	Geotag::the_geotag('print_map', $options);
    }
  4. le soleil
    Member
    Posted 2 years ago #

    And a map for single post?

  5. Boris
    Member
    Plugin Author

    Posted 2 years ago #

    Something like

    'marker_query' => 'numberposts=1&cat=2'

    Please have a look at this page: http://codex.wordpress.org/Function_Reference/WP_Query

  6. enkosynthesys
    Member
    Posted 1 year ago #

    i've added a couple of lines to geotag.php, the_geotag function, line 2479, plugi version 2.0:
    [Code moderated as per the Forum Rules. Please use the pastebin]

    notice the elseif condition added. thats all. works for my single post template, when calling like this:

    if (class_exists('Geotag')) {
    	$options = array(
    	'width' => '100%',
    	'height' => '400px',
    	'visible' => true,
    	'readexiftags' => true,
    	'init_on_pageload' => true,
    	'post_id' => ''.$post->ID
    	);
    	Geotag::the_geotag('print_map', $options);
    	}
  7. meyermed
    Member
    Posted 1 year ago #

    enkosynthesys is it possible to rewrite what you wrote some how? I think the moderator deleted exactly what you were trying to describe, and the "elseif" command is not in your post.

  8. enkosynthesys
    Member
    Posted 1 year ago #

  9. meyermed
    Member
    Posted 1 year ago #

    additionally, does anyone know how to post a generic gmap (like those examples state above), but limit it to perhaps the last 5 posts?

    Thanks again.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags