jp_sitemap_filename

The name (with extension) of a sitemap file of the given type and number.

Description

(string) jp_sitemap_filename( (string) $type, (null) $number = null ); 

Returns (string)

The filename.

Parameters (2)

0. $type (string)
The sitemap type.
1. $number — Optional. (null) => null
The sitemap number.

Usage

  1. if ( !function_exists( 'jp_sitemap_filename' ) ) { 
  2. require_once '/modules/sitemaps/sitemap-constants.php'; 
  3.  
  4. // The sitemap type. 
  5. $type = ''; 
  6.  
  7. // The sitemap number. 
  8. $number = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = jp_sitemap_filename($type, $number); 
  12.  

Defined (1)

The function is defined in the following location(s).

/modules/sitemaps/sitemap-constants.php  
  1. function jp_sitemap_filename( $type, $number = null ) { 
  2. if ( is_null( $number ) ) { 
  3. return "error-not-int-$type-$number.xml"; 
  4. } elseif ( JP_MASTER_SITEMAP_TYPE === $type ) { 
  5. return 'sitemap.xml'; 
  6. } elseif ( JP_PAGE_SITEMAP_TYPE === $type ) { 
  7. return "sitemap-$number.xml"; 
  8. } elseif ( JP_PAGE_SITEMAP_INDEX_TYPE === $type ) { 
  9. return "sitemap-index-$number.xml"; 
  10. } elseif ( JP_IMAGE_SITEMAP_TYPE === $type ) { 
  11. return "image-sitemap-$number.xml"; 
  12. } elseif ( JP_IMAGE_SITEMAP_INDEX_TYPE === $type ) { 
  13. return "image-sitemap-index-$number.xml"; 
  14. } elseif ( JP_VIDEO_SITEMAP_TYPE === $type ) { 
  15. return "video-sitemap-$number.xml"; 
  16. } elseif ( JP_VIDEO_SITEMAP_INDEX_TYPE === $type ) { 
  17. return "video-sitemap-index-$number.xml"; 
  18. } else { 
  19. return "error-bad-type-$type-$number.xml";