Today I complete two easy tasks:
- intercept the URL http://www.myblog.com/sitemap.xml to serve the sitemap (it will work only with WordPress on Apache and permalink active)
- ping Google when something happens in WordPress (eg. a post changed)
The two modifications are very easy. The first is a matter to do a little parsing of request uri:
substr($_SERVER[‘REQUEST_URI’], strlen($_SERVER[‘REQUEST_URI’])-11) == ‘sitemap.xml’
and to add a checkbox in the options panel to enable this feature.
The second, ping Google, it’s easy too, but for sake of semplicity, I wrote it to work only on WordPress 2.7 (which has some new libraries).
Google can be pinged for a news sitemap calling:
and the call is made using wp_remote_get (a special function of WordPress).
The final version of sitemap: [download id=”12″]