|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Module Name: Sitemaps |
|
4
|
|
|
* Module Description: Make it easy for search engines to find your site. |
|
5
|
|
|
* Sort Order: 13 |
|
6
|
|
|
* First Introduced: 3.9 |
|
7
|
|
|
* Requires Connection: No |
|
8
|
|
|
* Auto Activate: Public |
|
9
|
|
|
* Module Tags: Recommended, Traffic |
|
10
|
|
|
* Additional Search Queries: sitemap, traffic, search, site map, seo |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Disable direct access and execution. |
|
15
|
|
|
*/ |
|
16
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
|
17
|
|
|
exit; |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
if ( '1' == get_option( 'blog_public' ) ) { |
|
21
|
|
|
include_once 'sitemaps/sitemaps.php'; |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
add_action( 'jetpack_activate_module_sitemaps', 'jetpack_sitemap_on_activate' ); |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Run when Sitemaps module is activated. |
|
28
|
|
|
* |
|
29
|
|
|
* @since 4.8.0 |
|
30
|
|
|
*/ |
|
31
|
|
|
function jetpack_sitemap_on_activate() { |
|
32
|
|
|
require_once dirname( __FILE__ ) . '/sitemaps/sitemap-constants.php'; |
|
33
|
|
|
require_once dirname( __FILE__ ) . '/sitemaps/sitemap-buffer.php'; |
|
34
|
|
|
require_once dirname( __FILE__ ) . '/sitemaps/sitemap-stylist.php'; |
|
35
|
|
|
require_once dirname( __FILE__ ) . '/sitemaps/sitemap-librarian.php'; |
|
36
|
|
|
require_once dirname( __FILE__ ) . '/sitemaps/sitemap-finder.php'; |
|
37
|
|
|
require_once dirname( __FILE__ ) . '/sitemaps/sitemap-builder.php'; |
|
38
|
|
|
|
|
39
|
|
|
wp_clear_scheduled_hook( 'jp_sitemap_cron_hook' ); |
|
40
|
|
|
wp_clear_scheduled_hook( 'jetpack_sitemap_generate_on_activate' ); |
|
41
|
|
|
|
|
42
|
|
|
add_action( 'jetpack_sitemap_generate_on_activate', 'jetpack_sitemap_creation_job' ); |
|
43
|
|
|
|
|
44
|
|
|
wp_schedule_single_event( time() + 60, 'jetpack_sitemap_generate_on_activate' ); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Initial sitemap creation |
|
49
|
|
|
* |
|
50
|
|
|
* @since 6.7.0 |
|
51
|
|
|
*/ |
|
52
|
|
|
|
|
53
|
|
|
function jetpack_sitemap_creation_job() { |
|
54
|
|
|
$sitemap_builder = new Jetpack_Sitemap_Builder(); |
|
55
|
|
|
$sitemap_builder->update_sitemap(); |
|
56
|
|
|
} |
|
57
|
|
|
|