Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Añadir los sitemaps de DNG Photo Magazine al index sitemap de YOAST
function cl_add_sitemap_yoast() {
$mes = date( 'm' );
$anhio = date( 'Y' );
$res = '';
$url_raiz = 'https://www.fotodng.com/dng-includes/sitemaps/';
$array_sitemaps[] = 'concurso_dng_06-sitemap_dng.xml';
$array_sitemaps[] = 'concurso_dng_07-sitemap_dng.xml';
$array_sitemaps[] = 'concurso_dng_08-sitemap_dng.xml';
$array_sitemaps[] = 'concurso_dng_09-sitemap_dng.xml';
$array_sitemaps[] = 'concurso_dng_10-sitemap_dng.xml';
$array_sitemaps[] = 'concurso_dng_11-sitemap_dng.xml';
$array_sitemaps[] = 'concurso_dng_12-sitemap_dng.xml';
$array_sitemaps[] = 'concurso_dng_13-sitemap_dng.xml';
$array_sitemaps[] = 'concurso_dng_14-sitemap_dng.xml';
$array_sitemaps[] = 'concurso_dng_15-sitemap_dng.xml';
foreach ( $array_sitemaps as $val ) {
$res .= '<sitemap>';
$res .= '<loc>' . $url_raiz . $val . '</loc>';
$res .= '<lastmod>' . $anhio . '-' . $mes . '-01T00:14:21+01:00</lastmod>';
$res .= '</sitemap>';
}
// Añadimos el sitemap de números de la revista, descarga y online.
$res .= '<sitemap>';
$res .= '<loc>' . $url_raiz . 'revista_dng-sitemap_dng.xml</loc>';
$res .= '<lastmod>' . $anhio . '-' . $mes . '-01T00:14:21+01:00</lastmod>';
$res .= '</sitemap>';
return $res;
}
add_filter( 'wpseo_sitemap_index', 'cl_add_sitemap_yoast' )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment