public function fetch_exporter()
{
do_action('apple_news_do_fetch_exporter', $this->id);
// Fetch WP_Post object, and all required post information to fill up the
// Exporter_Content instance.
$post = get_post($this->id);
// Build the excerpt if required
if (empty($post->post_excerpt)) {
$excerpt = wp_trim_words(strip_tags(strip_shortcodes($post->post_content)), 55, '...');
} else {
$excerpt = strip_tags($post->post_excerpt);
}
// Get the post thumbnail
$post_thumb = wp_get_attachment_url(get_post_thumbnail_id($this->id)) ?: null;
// Build the byline
$byline = $this->format_byline($post);
// Filter each of our items before passing into the exporter class.
$title = apply_filters('apple_news_exporter_title', $post->post_title, $post->ID);
$excerpt = apply_filters('apple_news_exporter_excerpt', $excerpt, $post->ID);
$post_thumb = apply_filters('apple_news_exporter_post_thumb', $post_thumb, $post->ID);
$byline = apply_filters('apple_news_exporter_byline', $byline, $post->ID);
// The post_content is not raw HTML, as WordPress editor cleans up
// paragraphs and new lines, so we need to transform the content to
// HTML. We use 'the_content' filter for that.
$content = apply_filters('apple_news_exporter_content_pre', $post->post_content, $post->ID);
$content = apply_filters('the_content', $content);
$content = apply_filters('apple_news_exporter_content', $content, $post->ID);
// Now pass all the variables into the Exporter_Content array.
$base_content = new Exporter_Content($post->ID, $title, $content, $excerpt, $post_thumb, $byline, $this->fetch_content_settings());
return new Exporter($base_content, null, $this->settings);
}