Created
August 15, 2023 04:36
-
-
Save ManiruzzamanAkash/3a9f162a278aa18e1a2fae53608bf1a3 to your computer and use it in GitHub Desktop.
WordPress sample test Sitemap generator example
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
<?php | |
wp_register_sitemap_provider( 'test', new TestSiteMap() ); | |
/** | |
* XML sitemap provider. | |
*/ | |
class TestSiteMap extends \WP_Sitemaps_Provider { | |
public function __construct() { | |
$this->name = 'tests'; | |
} | |
public function get_url_list( $page_num, $object_subtype = '' ) { | |
$url_list[] = array( | |
'loc' => 'https://www.google.com', | |
); | |
return $url_list; | |
} | |
public function get_max_num_pages( $object_subtype = '' ) { | |
return 1; // change as your needs. | |
} | |
protected function get_max_urls() { | |
return 100; // change if wants to change from 100 to any other. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment