Skip to content

Instantly share code, notes, and snippets.

@liambolling
Last active August 29, 2015 14:02
Show Gist options
  • Save liambolling/63b2458fd61020242399 to your computer and use it in GitHub Desktop.
Save liambolling/63b2458fd61020242399 to your computer and use it in GitHub Desktop.
Example - Pull recent events from iuifc.org
//This is the exact code that we use to display recent events on our homepage and through out the website.
//Import the file
$file = 'https://iuifc.org/wp-content/themes/iuifc/json-data/public_calendar_5_recent.json';
//This url will just show all events in order they were created.
//https://iuifc.org/wp-content/themes/iuifc/json-data/public_calendar_data.json
//Decode them into something we can work with
$json_array = json_decode(file_get_contents($file), true);
//Run through 3 times and display some information about upcoming events
for ($i = 0; $i <= 3; $i++) {
echo $json_array[$i]['nice_title'];
echo $json_array[$i]['start'];
echo $json_array[$i]['url'];
echo $json_array[$i]['location'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment