[Plugin: Google Calendar Feed Parser] A small hack
-
Here is a small modification to the display part of the plugin. I needed to display the items in day order with the weekday as a header. Instead of display´ing the day today as “Tuesday” it is displayed as “Today” and “Wednesday” is displayed “Tomorrow”.
It´s in Icelandic so just change the string 🙂
Replace all string in the ‘gcalparse.php’ below the comment part:
/**
* gcal_parse_feed – Main function parses and displays the calendar feed
*/To make it arty just modify your CSS 🙂
/** * gcal_parse_feed - Main function parses and displays the calendar feed */ function gcal_parse_feed() { $feed_url = get_option('gcal_feed_url'); $feed_url .= '&max-results=' . (( get_option('gcal_max_results') == '' ) ? '4' : get_option('gcal_max_results')); $xmlstr = wp_remote_fopen($feed_url); $static_url = get_option('gcal_static_url_option'); $xml = new SimpleXMLElement($xmlstr); echo '<div id="events">'; foreach($xml->entry as $entry) { $gd = $entry->children('http://schemas.google.com/g/2005'); $event_link = $entry->link->attributes()->href; /* if ( $static_url ) { echo '<a href="' . get_option('gcal_static_url') . '">' . $entry->title . "</a>\n"; } else { echo '<a href="' . $event_link . '">' . $entry->title . "</a>\n"; } */ if (($offset = get_option('gcal_timezone_offset')) == '') $offset = 0; $classstarts = date("H:i", strtotime($gd->when->attributes()->startTime) + $offset); $classfinishes = date("H:i", strtotime($gd->when->attributes()->endTime) + $offset); $classdate = date("j. F", strtotime($gd->when->attributes()->startTime) + $offset); switch ($classdate) { case (date("j. F")): if ($settitle0 <> true) { echo '<lh>Í dag</lh>'; } echo '<div class="event"><ul>'; echo '<li>'.$classstarts.' til '.$classfinishes.' - '.$entry->title.'</li>'; echo '</ul></div>'; $settitle0 = true; break; case (date("j. F", strtotime("+1 days"))): if ($settitle1 <> true) { echo '<lh>Á morgun</lh>'; } echo '<div class="event"><ul>'; echo '<li>'.$classstarts.' til '.$classfinishes.' - '.$entry->title.'</li>'; echo '</ul></div>'; $settitle1 = true; break; case (date("j. F", strtotime("+2 days"))): if ($settitle2 <> true) { echo '<lh>'.date("l", strtotime("+2 days")).'</lh>'; } echo '<div class="event"><ul>'; echo '<li>'.$classstarts.' til '.$classfinishes.' - '.$entry->title.'</li>'; echo '</ul></div>'; $settitle2 = true; break; case (date("j. F", strtotime("+3 days"))): if ($settitle3 <> true) { echo '<lh>'.date("l", strtotime("+3 days")).'</lh>'; } echo '<div class="event"><ul>'; echo '<li>'.$classstarts.' til '.$classfinishes.' - '.$entry->title.'</li>'; echo '</ul></div>'; $settitle3 = true; break; case (date("j. F", strtotime("+4 days"))): if ($settitle4 <> true) { echo '<lh>'.date("l", strtotime("+4 days")).'</lh>'; } echo '<div class="event"><ul>'; echo '<li>'.$classstarts.' til '.$classfinishes.' - '.$entry->title.'</li>'; echo '</ul></div>'; $settitle4 = true; break; } } echo '</div>'; } ?>http://ww.wp.xz.cn/extend/plugins/google-calendar-feed-parser/
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘[Plugin: Google Calendar Feed Parser] A small hack’ is closed to new replies.