tmlspecialchars( $url['loc'] ) ) . '', 2 ); $output .= $renderer->newline( '', 2 ); $output .= $this->get_news_publication( $renderer, $url ); $output .= empty( $date ) ? '' : $renderer->newline( '' . htmlspecialchars( $date ) . '', 3 ); $output .= $renderer->add_cdata( $url['title'], 'news:title', 3 ); $output .= $renderer->newline( '', 2 ); $output .= $renderer->newline( '', 1 ); /** * Filters the output for the sitemap url tag. * * @param string $output The output for the sitemap url tag. * @param array $url The sitemap url array on which the output is based. */ return $this->do_filter( 'sitemap_url', $output, $url ); } /** * Change default schema type on News Posts. * * @param string $schema Default schema type. * @param string $post_type Current Post Type. * @param int $post_id Current Post ID. * * @return string */ public function change_default_schema_type( $schema, $post_type, $post_id ) { $news_post_types = (array) Helper::get_settings( 'sitemap.news_sitemap_post_type' ); if ( ! in_array( $post_type, $news_post_types, true ) ) { return $schema; } $exclude_terms = (array) Helper::get_settings( "sitemap.news_sitemap_exclude_{$post_type}_terms" ); if ( empty( $exclude_terms[0] ) ) { return 'NewsArticle'; } $has_excluded_term = false; foreach ( $exclude_terms[0] as $taxonomy => $terms ) { if ( has_term( $terms, $taxonomy, $post_id ) ) { $has_excluded_term = true; break; } } return $has_excluded_term ? $schema : 'NewsArticle'; } /** * Filter to add Copyrights data in Article Schema on News Posts. * * @param array $entity Snippet Data. * @return array */ public function add_copyrights_data( $entity ) { global $post; if ( is_null( $post ) ) { return $entity; } $news_post_types = (array) Helper::get_settings( 'sitemap.news_sitemap_post_type' ); if ( ! in_array( $post->post_type, $news_post_types, true ) ) { return $entity; } $entity['copyrightYear'] = get_the_modified_date( 'Y', $post ); if ( ! empty( $entity['publisher'] ) ) { $entity['copyrightHolder'] = $entity['publisher']; } return $entity; } /** * Get News Pub Tags. * * @param Renderer $renderer Sitemap renderer class object. * @param array $entity Array of parts that make up this entry. * @return string */ private function get_news_publication( $renderer, $entity ) { $lang = Locale::get_site_language(); /** * Filter: 'rank_math/sitemap/news/language' - Allow changing the news language based on the entity. * * @param string $lang Language code. * @param array $entity Array of parts that make up this entry. */ $lang = $this->do_filter( 'sitemap/news/language', $lang, $entity ); $name = Helper::get_settings( 'sitemap.news_sitemap_publication_name' ); $name = $name ? $name : get_bloginfo( 'name' ); $news_publication = ''; $news_publication .= $renderer->newline( '', 3 ); $news_publication .= $renderer->newline( '' . esc_html( $name ) . '', 4 ); $news_publication .= $renderer->newline( '' . $lang . '', 4 ); $news_publication .= $renderer->newline( '', 3 ); return $news_publication; } }
Warning: Cannot modify header information - headers already sent by (output started at /htdocs/le-blog.fr/wp-content/plugins/seo-by-rank-math-pro/includes/modules/news-sitemap/class-news-sitemap.php:1) in /htdocs/le-blog.fr/wp-includes/pluggable.php on line 1531

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/le-blog.fr/wp-content/plugins/seo-by-rank-math-pro/includes/modules/news-sitemap/class-news-sitemap.php:1) in /htdocs/le-blog.fr/wp-includes/pluggable.php on line 1534