Home › Forums › Calendar Products › Events Calendar PRO › ICS feed for all existing (but not past) events
- This topic has 6 replies, 2 voices, and was last updated 10 years, 11 months ago by
Barry.
-
AuthorPosts
-
April 28, 2015 at 7:23 pm #959141
Mark
ParticipantI noticed that when you copy/paste the URL for the ICS feed for our events, that it only pulls up that page’s events. I scoured through the forums and was only able to find one topic that led me to this code:
add_action( ‘pre_get_posts’, ‘full_ical_export’ );
function full_ical_export( WP_Query $query ) {
if ( ! isset( $_GET[‘ical’] ) || ! isset( $_GET[‘full-export’] ) ) return;
if ( ! isset( $query->tribe_is_event_query ) || ! $query->tribe_is_event_query ) return;$query->set( ‘eventDisplay’, ‘custom’ );
$query->set( ‘start_date’, ‘1000-01-01’ );
$query->set( ‘end_date’, ‘3000-01-01’ );
$query->set( ‘posts_per_page’, ‘-1’ );
}However, I do not want to pull any previous events or past dates to avoid any memory problems. Is there a way to add code or find a way to pull the ICS feed for all current existing events to come?
April 29, 2015 at 7:43 am #959247Barry
MemberHi Mark,
So what you’re experiencing is the expected and intentional behaviour.
If you want to leverage the code snippet you found you can certainly give that a go. Simply replace 1000-01-01 with now (still within single quotes) and it should do what you want here 🙂
Does that help?
April 29, 2015 at 10:38 am #959302Mark
ParticipantAdding that code seems to create syntax errors. My current functions.php file looks like this, which is causing errors:
<?php
/**
* Remove “share” prompt text from end of gCal-exported descriptions.
* @link http://theeventscalendar.com/support/forums/topic/sharing-options-for-events/
*/
function remove_tags_from_gcal_links( array $params ) {$cleaned = html_entity_decode( strip_tags( apply_filters( ‘the_content’, urldecode( $params[‘details’] ) ) ), ENT_QUOTES, ‘UTF-8’ );
$to_remove = ‘Share this with others via:’;
$pos = ( strlen( $cleaned ) – strpos( $cleaned, $to_remove ) );
$trimmed = substr( $cleaned, 0, ( -$pos ) );$params[‘details’] = urlencode( $trimmed );
return $params;
}add_filter( ‘tribe_google_calendar_parameters’, ‘remove_tags_from_gcal_links’ );
// Second solution – links on the right of the organizer box (after)
add_action( ‘tribe_events_single_event_meta_primary_section_end’, array( ‘TribeiCal’, ‘single_event_links’ ) );
remove_action( ‘tribe_events_single_event_after_the_content’, array( ‘TribeiCal’, ‘single_event_links’ ) );add_action( ‘pre_get_posts’, ‘full_ical_export’ );
function full_ical_export( WP_Query $query ) {
if ( ! isset( $_GET[‘ical’] ) || ! isset( $_GET[‘full-export’] ) ) return;
if ( ! isset( $query->tribe_is_event_query ) || ! $query->tribe_is_event_query ) return;$query->set( ‘eventDisplay’, ‘custom’ );
$query->set( ‘start_date’, ‘now′ );
$query->set( ‘end_date’, ‘3000-01-01′ );
$query->set( ‘posts_per_page’, ‘-1′ );
}?>
April 29, 2015 at 11:02 am #959311Barry
MemberHi Mark!
It’s hard to assess for syntax errors when you paste code in plain text (simply because so many characters are converted to a form that would be “illegal” within a PHP environment).
What are the actual errors you are hitting here and can you share the code via Pastebin, Gist or some other similar tool?
Thanks!
April 29, 2015 at 11:09 am #959316Mark
ParticipantHere is the code I am using: https://gist.github.com/anonymous/32ad876dcb9fa147f18f
The error I get is this:
Parse error: syntax error, unexpected T_STRING in /home/anccbell/public_html/wp-content/themes/salient-child/functions.php on line 8April 29, 2015 at 2:45 pm #959401Barry
MemberHi Mark,
So sometimes when you copy and paste code from the forums, depending on how it was formatted and a few other factors, various symbols can be transformed.
In this case, take a look at the single quotes on line 8 (and you’ll actually see the same thing throughout the code you shared). These should be straight quotes – but instead we have a different form of quote, a “fancy quote” if you will, that PHP doesn’t understand – you’ll need to correct these and any other symbols that have similarly been transformed.
Wrong:
apply_filters( ‘the_content’, urldecode( $params[‘details’] ) )Right:
apply_filters( 'the_content', urldecode( $params['details'] ) )As you correct things if you get any further errors of a similar nature please check out the referenced line and see if any of the symbols jump out at you 🙂
May 14, 2015 at 7:33 am #962585Barry
MemberHi!
It’s been a while so I’m going to go ahead and close this topic.
- Need help with anything else? Go right ahead and post a new topic, one of the team will be only too happy to help
- Still need help with this issue and need to re-open it? Again, please simply create a new topic and link to this one to provide the team with some context
Thanks!
-
AuthorPosts
- The topic ‘ICS feed for all existing (but not past) events’ is closed to new replies.
