Last active
June 1, 2016 07:48
-
-
Save subharanjanm/885a0e7a63ad8d4f142c545221ea7e0c to your computer and use it in GitHub Desktop.
Adds a new sitemap entry for Axelerant Presentation Slides into the sitemap index created by Yoast SEO plugin. `wpseo_sitemap_index` , `wpseo_enable_xml_sitemap_transient_caching`
This file contains hidden or 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
<?php | |
/** | |
* Plugin Name: AXL Slides Sitemap | |
* Plugin URI: https://gist.github.com/subharanjanm/885a0e7a63ad8d4f142c545221ea7e0c | |
* Description: Adds a new sitemap entry for Axelerant Presentation Slides into the sitemap index created by Yoast SEO plugin. | |
* Version: 1.0 | |
* Author: Subharanjan | |
* Author URI: https://gist.github.com/subharanjanm/885a0e7a63ad8d4f142c545221ea7e0c | |
* License: GPLv2 or later | |
*/ | |
defined( 'ABSPATH' ) or die( "No script kiddies please!" ); | |
function axl_add_sitemap_slides() { | |
if ( class_exists( 'WPSEO_Sitemaps' ) ) { | |
$plugin_file = pathinfo( $_SERVER['PHP_SELF'] ); | |
$modification_time = date( "c", filemtime( $plugin_file["basename"] ) ); | |
$slides_sitemap_xml = plugins_url( 'slides-sitemap.xml', __FILE__ ); | |
$slides_sitemap = '<sitemap>' . "\n"; | |
$slides_sitemap .= '<loc>' . $slides_sitemap_xml . '</loc>' . "\n"; | |
$slides_sitemap .= '<lastmod>' . $modification_time . '</lastmod>' . "\n"; | |
$slides_sitemap .= '</sitemap>' . "\n"; | |
return $slides_sitemap; | |
} | |
return ''; | |
} | |
add_filter( 'wpseo_sitemap_index', 'axl_add_sitemap_slides' ); | |
add_filter( 'wpseo_enable_xml_sitemap_transient_caching', '__return_false' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create an xml file with the custom urls and store it somewhere in your server. ( say
slides-sitemap.xml
). Use it's path in the above code.