Changeset 10284 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-type.php
- Timestamp:
- 09/24/2020 03:09:17 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-type.php
r10283 r10284 14 14 add_action( 'manage_wporg_workshop_posts_custom_column', __NAMESPACE__ . '\render_workshop_list_table_columns', 10, 2 ); 15 15 add_filter( 'jetpack_sitemap_post_types', __NAMESPACE__ . '\jetpack_sitemap_post_types' ); 16 add_filter( 'jetpack_page_sitemap_other_urls', __NAMESPACE__ . '\jetpack_page_sitemap_other_urls' ); 16 17 17 18 /** … … 274 275 /** 275 276 * Register our post types with Jetpack Sitemaps. 277 * 276 278 * @link https://developer.jetpack.com/hooks/jetpack_sitemap_post_types/ 277 279 * … … 285 287 return $post_types; 286 288 } 289 290 /** 291 * Register our post type archives with Jetpack Sitemaps. 292 * 293 * @link https://developer.jetpack.com/hooks/jetpack_page_sitemap_other_urls/ 294 * 295 * @param array $urls 296 * @return array 297 */ 298 function jetpack_page_sitemap_other_urls( $urls ) { 299 foreach ( array( 'wporg_workshop', 'lesson-plan' ) as $post_type ) { 300 $url = get_post_type_archive_link( $post_type ); 301 if ( ! $url ) { 302 continue; 303 } 304 305 $latest_post = get_posts( array( 306 'post_type' => $post_type, 307 'numberposts' => 1, 308 'orderby' => 'date', 309 'order' => 'DESC', 310 ) ); 311 if ( ! $latest_post ) { 312 continue; 313 } 314 315 $urls[] = array( 316 'loc' => $url, 317 'lastmod' => gmdate( 318 'Y-m-d\TH:i:s\Z', 319 strtotime( $latest_post[0]->post_modified_gmt ) 320 ), 321 ); 322 } 323 324 return $urls; 325 }
Note: See TracChangeset
for help on using the changeset viewer.