Created
March 15, 2017 19:04
-
-
Save CarlosLongarela/d7d33170120366d8ae106810a39e982c to your computer and use it in GitHub Desktop.
Añadir los sitemaps de DNG Photo Magazine al index sitemap de YOAST
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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