WordPress: XML-Sitemap: Zusätzliche Seiten hinzufügen

Auf compulearnenglisch.de/uebung finden sich viele generierte Seiten, die nicht in der WordPress Datenbank gespeichert sind. Demnach werden diese Seiten nicht automatisch in der Xml-Sitemap aufgenommen.

Ein Blick in die Dokumentation genügt allerdings um das Problem zu lösen:

Adding other pages to the sitemap via other plugins

This plugin uses the action system of WordPress to allow other plugins to add urls to the sitemap. Simply add your function with add_action to the list and the plugin will execute yours every time the sitemap is build. Use the static method “GetInstance” to get the generator and AddUrl method to add your content.

1
2
3
4
5
function your_pages() {
  $generatorObject = &GoogleSitemapGenerator::GetInstance(); //Please note the "&" sign for PHP4!
  if($generatorObject!=null) $generatorObject->AddUrl("http://blog.uri/tags/hello/",time(),"daily",0.5);
}
add_action("sm_buildmap","your_pages");

Keine Kommentare

Noch keine Kommentare.

RSS Feed für Kommentare zu diesem Artikel. TrackBack URI

Hinterlasse einen Kommentar

WordPress Themes