Skip to content

Commit

Permalink
Support: HelpHub: Add helphub post types to Jetpack sitemaps
Browse files Browse the repository at this point in the history
This adds articles & versions to the generated sitemap.
  • Loading branch information
ryelle committed Jul 29, 2024
1 parent 31d566e commit 3705220
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public function __construct( $post_type = 'thing', $singular = '', $plural = '',
}
add_action( 'admin_init', array( $this, 'add_menu_order' ) );
add_action( 'after_setup_theme', array( $this, 'ensure_post_thumbnails_support' ) );
add_filter( 'jetpack_sitemap_post_types', array( $this, 'add_post_type_to_sitemaps' ) );
} // End __construct()

/**
Expand Down Expand Up @@ -793,6 +794,19 @@ public function ensure_post_thumbnails_support() {
*/
public function add_menu_order() {
add_post_type_support( 'post', 'page-attributes' );
} // End ens
} // End add_menu_order

/**
* Filter the post types Jetpack uses to generate the sitemaps.
*
* @param string[] $post_types Current list of post types.
*
* @return string[]
*/
public function add_post_type_to_sitemaps( $post_types ) {
if ( ! in_array( $this->post_type, $post_types ) ) {
$post_types[] = $this->post_type;
}
return $post_types;
} // End add_post_type_to_sitemaps
} // End Class

0 comments on commit 3705220

Please sign in to comment.