/** * Adds feed discover links to WordPress head. */ function podlove_add_feed_discoverability() { if (is_admin()) { return; } if (!function_exists('\\Podlove\\Feeds\\prepare_for_feed')) { require_once \Podlove\PLUGIN_DIR . 'lib/feeds/base.php'; } $cache = \Podlove\Cache\TemplateCache::get_instance(); echo $cache->cache_for('feed_discoverability', function () { $feeds = \Podlove\Model\Podcast::get()->feeds(); $html = ''; foreach ($feeds as $feed) { if ($feed->discoverable) { $html .= '<link rel="alternate" type="' . $feed->get_content_type() . '" title="' . \Podlove\Feeds\prepare_for_feed($feed->title_for_discovery()) . '" href="' . $feed->get_subscribe_url() . "\" />\n"; } } return $html; }); }
public function get_alternate_links() { $html = ''; foreach (self::find_all_by_discoverable(1) as $feed) { if ($feed->id !== $this->id) { $html .= "\n\t" . self::get_link_tag(array('prefix' => 'atom', 'rel' => 'alternate', 'type' => $feed->get_content_type(), 'title' => \Podlove\Feeds\prepare_for_feed($feed->title_for_discovery()), 'href' => $feed->get_subscribe_url())); } } return apply_filters('podlove_feed_alternate_links', $html); }