WordPress.org

Ready to get started?Download WordPress

Forums

Google XML Sitemaps
Using XML sitemap to create a geositemap? (1 post)

  1. RobertHarm
    Member
    Posted 2 years ago #

    I am the developer of the mapping plugin http://www.mapsmarker.com and would like to add a geo sitemap in one of the next versions
    (https://code.google.com/intl/de-AT/apis/kml/documentation/kmlSearch.html)
    Best would be to use your plugin to add the map info to the generated sitemap.xml-file from Google XML site map with the following function:

    function lmm_add_markers_to_sitemap() {
        if (lmm_is_plugin_active('google-sitemap-generator/sitemap.php')){
            $start = round(microtime(true),4);
            @set_time_limit(120);
            global $wpdb;
             $generatorObject = &GoogleSitemapGenerator::GetInstance();
            $markers = $wpdb->get_results("SELECT id FROM '.$table_name_markers.' ORDER BY createdon DESC");
    
            foreach ($markers as $marker) {
                $georsslink = LEAFLET_PLUGIN_URL . "leaflet-georss.php?marker=" . $marker['id'];
                $generatorObject->AddUrl($georsslink,time(),"weekly",0.3);
                }
            $end = round(microtime(true),4);
        }
    }

    Unfortunately this is not working as GeoSitemaps require an additional namespace within the <urlset>-tag:
    xmlns:geo="http://www.google.com/geo/schemas/sitemap/1.0" and I would need a function like AddGeoURL()
    which adds the maps to the sitemap like this:

    <url>
          <loc>http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/leaflet-georss.php?marker=1</loc>
          <geo:geo>
            <geo:format>georss</geo:format>
          </geo:geo>
        </url>

    The output for this function could be triggered by code like this:

    foreach ($markers as $marker) {
                $georsslink = LEAFLET_PLUGIN_URL . "leaflet-georss.php?marker=" . $marker['id'];
                $generatorObject->AddGeoUrl($georsslink,"georss");
                }

    you write in the your post about the beta version, that there is a new API which developers can build upon.
    Is the usecase I am describing above possible with the API?
    Thanks for any help!

    http://wordpress.org/extend/plugins/google-sitemap-generator/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by RobertHarm
  • This topic is not a support question
  • WordPress version: 3.3.1