Shoora
4/22/2019 - 9:42 AM

Añadir los sitemaps de DNG Photo Magazine al index sitemap de YOAST

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' )