-
-
Save anthonycole/3607542 to your computer and use it in GitHub Desktop.
GeoRSS Support for the location extension of Advanced Custom Fields. Work in progress.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: GeoRSS ACF Extension | |
Author: Anthony Cole | |
Author URI: http://anthonycole.me/ | |
Description: Extends ACF Locations extension to allow plotting multiple locations on a map with GeoRSS | |
Version: 0.5 | |
*/ | |
class GeoRSS_Map { | |
public static function init() { | |
add_action('query_vars', 'GeoRSS_Map::acf_queryvars'); | |
add_action('init', 'GeoRSS:Map::index'); | |
} | |
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 ) : | |
setup_postdata($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; | |
} | |
public static function acf_init() { | |
if( 'true' == get_query_var('georss') ) { | |
$args = self::show_georss(get_posts($args)); | |
exit; | |
} | |
} | |
} | |
GeoRSS_Map::init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment