I have added a new sitemap url to Yoast's sitemap_index using this function:
function add_my_sitemap()
{
$url = site_url() . '/my-sitemap.xml';
$sitemap = "";
$sitemap .= "<sitemap><loc>$url</loc><lastmod></lastmod></sitemap>";
return $sitemap;
}
add_action('wpseo_sitemap_index', 'add_my_sitemap');
Now how can I show the content of that sitemap? I do not want to create a file but a function that generate the sitemap on the fly but I can't find anything on yoast's documentation about this.
Any advice?