Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add Liveblog entries to the feed
* Output Liveblog entries as part of feed content
if ( class_exists( 'WPCOM_Liveblog' ) )
add_filter( 'the_content_feed', 'x_add_liveblog_entries_to_feed_content' );
function x_add_liveblog_entries_to_feed_content( $content ) {
if ( WPCOM_Liveblog::is_liveblog_post() ) {
$post_id = get_the_ID();
$liveblog_query = new WPCOM_Liveblog_Entry_Query( $post_id, WPCOM_Liveblog::key );
$liveblog_entries = $liveblog_query->get_all();
$content .= PHP_EOL;
$content .= '<h2 class="from-liveblog">From the Liveblog</h2>';
foreach ( $liveblog_entries as $liveblog_entry ) {
$entry_info = $liveblog_entry->get_fields_for_render();
$content .= '<h5 class="from-liveblog-time">' . $entry_info['entry_time'] . '</h5>' . $entry_info['content'];
return $content;

This comment has been minimized.

Copy link

commented Jul 9, 2013

I wonder if this can be used to create a feed for the liveblog itself, so that can be pushed to social networks and tumblr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.