Adding UTW tags to Google Sitemap Generator 3.0b
-
Having looked at the Google Sitemap Generator 3.0b documentation, it mentions that you can add your own code to automatically add new URLs to the sitemap. UltimateTagWarrior (UTW3) populates a tag table with its own tag names, and I would like to automatically add all these tags into the sitemap, e.g.
https://www.dicontas.co.uk/blog/index.php?tag=tagname1
https://www.dicontas.co.uk/blog/index.php?tag=tagname2I have created the code, but I do not know where to put this? Do I add my code to the sitemap.php file, and if so where? If not, what file do I create and how do I call this when GSG executes from the Admin panel?
My code is as follows – anyone is free to use/modify it as they see fit…
tags
/**
* Retrieves the tags from UTW - Author : Stewart Farquhar
*/
function GetUTWtags() {
$utwtagObject = &GoogleSitemapGenerator::GetInstance(); //Please note the "&" sign!
$utwtags=array();
//Query UTW tags table and add them into the array
$utwtags=$wpdb->get_results("SELECTFROM
” . $wpdb->tags . “");
if($utwtags) {
foreach($utwtags as $utwtag) {
$utw_tag = "https://www.dicontas.co.uk/blog/index.php?tag=" . $utwtag->tag;
if($utwtagObject!=null) $utwtagObject->AddUrl($utw_tag,time(),"daily",0.6);
}
}
}
add_action("sm_buildmap","GetUTWtags");
Can anyone please assist?
- The topic ‘Adding UTW tags to Google Sitemap Generator 3.0b’ is closed to new replies.