Skip to content

Instantly share code, notes, and snippets.

Created September 3, 2012 06:43
Show Gist options
  • Save anonymous/3607380 to your computer and use it in GitHub Desktop.
Save anonymous/3607380 to your computer and use it in GitHub Desktop.
GeoRSS Support for the location extension of Advanced Custom Fields. Work in progress.
<?php
class GeoRSS_Map {
public static function init() {
add_action('query_vars', 'GeoRSS_Map::acf_queryvars');
}
public static function show_georss($posts) {
?>
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:georss="http://www.georss.org/georss">
<title><?php bloginfo_rss('title'); ?></title>
<subtitle><?php bloginfo_rss('title'); ?></subtitle>
<link href="<?php echo home_url(); ?>"/>
<updated>2005-12-13T18:30:02Z</updated>
<author>
<name><?php bloginfo_rss('title'); ?></name>
<email><?php bloginfo_rss('admin_email'); ?></email>
</author>
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
<?php foreach( $posts as $post ) : ?>
<entry>
<title><?php the_title_rss(); ?></title>
<link href="http://example.org/2005/09/09/atom01"/>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<updated>2005-08-17T07:02:32Z</updated>
<summary><?php the_excerpt_rss(); ?></summary>
<georss:point><?php self::get_field(); ?></georss:point>
</entry>
<?php endforeach; ?>
</feed>
<?php
}
public static function get_field() {
// need input from acf here.
}
public static function acf_queryvars($vars) {
$vars[] = 'georss';
return $vars;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment