Display event results in iCal feed

This commit is contained in:
Brian Miyaji
2014-10-22 21:24:21 +11:00
parent 6e3f511597
commit 42876f326f
3 changed files with 53 additions and 9 deletions

View File

@@ -25,11 +25,11 @@ class SP_Meta_Box_Calendar_Feeds {
$calendar_feeds = $feeds->calendar;
?>
<div>
<?php foreach ( $calendar_feeds as $slug => $name ) { ?>
<?php $link = add_query_arg( 'feed', 'sp-calendar-' . $slug, get_post_permalink( $post ) ); ?>
<?php foreach ( $calendar_feeds as $feed => $name ) { ?>
<?php $link = str_replace( array( 'http:', 'https:' ), 'webcal:', add_query_arg( 'feed', 'sp-' . $feed, untrailingslashit( get_post_permalink( $post ) ) ) ); ?>
<p>
<strong><?php echo $name; ?></strong>
<a class="sp-link" href="<?php echo $link; ?>" target="_blank" title="<?php _e( 'Link', 'sportspress' ); ?>"></a>
<a class="sp-link" href="<?php echo $link; ?>" title="<?php _e( 'Link', 'sportspress' ); ?>"></a>
</p>
<p>
<input type="text" value="<?php echo $link; ?>" readonly="readonly" class="code widefat">

View File

@@ -31,7 +31,7 @@ class SP_Feeds {
foreach ( $data as $type => $feeds ) {
foreach ( $feeds as $slug => $name ) {
$this->feed = $slug;
add_feed( 'sp-' . $type . '-' . $slug, array( $this, 'load_' . $type . '_' . $slug . '_feed' ) );
add_feed( 'sp-' . $slug, array( $this, $slug . '_feed' ) );
}
}
}
@@ -44,9 +44,8 @@ class SP_Feeds {
$this->data[ $key ] = $value;
}
public static function load_calendar_ical_feed() {
public static function ical_feed() {
$feed_template = SP()->plugin_path() . '/feeds/ical.php';
load_template( $feed_template );
}
}