Get your WordPress series in your XML sitemap
If you use the XML Sitemap Generator and Organize Series plugins for WordPress, then this is something you can use to get your series more noticed by Google and other search engines which pay attention to XML Sitemaps. If you take a look in your sitemap (http://example.com/sitemap.xml), you’ll notice that the series that you’ve been working hard to put together are no where to be seen. That’s because you have to let the Sitemap Generator know about them. The code snippet below, perfect for the functions.php file of your theme, will do just that.
add_action("sm_buildmap","scompt_series_sitemap");
function scompt_series_sitemap() {
if( !class_exists(GoogleSitemapGenerator) ||
!function_exists(get_series) ) return;
$gen = &GoogleSitemapGenerator::GetInstance();
if($gen != null) {
$all_series = get_series();
foreach( $all_series as $series ) {
$gen->AddUrl( get_series_link($series->term_id) );
}
}
}
I think the code is pretty self-explanatory. Lines 3 and 4 make sure that all the necessary bits have been loaded. Line 5 gets a copy of the object used to generate the sitemap and line 9 feeds it’s the URLs of your series pages. The AddUrl method takes a couple extra parameters that let you define last changed date, change frequency, and priority if you want.