The-Nexus.tv feeds currently display just the episode title. This creates an ambiguity when visitors either subscribe to the Master Feed or when a user subscribes to multiple singular series feeds. Today, I made a minor change that adds both the series name and the episode number.
The WordPress API is a travesty, but despite that, it’s actually very easy to change feeds. I used the_title_rss
filter.
add_filter('the_title_rss', 'convergence_feed_title_filter');
My function is called convergence_feed_title_filter
.
function convergence_feed_title_filter($content) { global $wp_query; $post_id = $wp_query->post->ID; $permalink = get_permalink($post_id); $categories = get_the_category($post_id); $category = $categories[0]; $string = $category->cat_name . ' #' . get_episode_number($permalink) . ": " . $content; return $string; }
First, we need to know what the current query is, then we need to get the post_id
out of it. Episode numbers at The-Nexus.tv are stored conveniently in the permalinks, so I get the permalink and then categories. Why? Because single_cat_title does not work well or as advertised. Running get_the_category works, but because there could be multiple categories, I just pulled the data from the first choice. That data is the cat_name
, and then I concatenated everything into a neat string: series name, episode number and then original title.