Created
November 17, 2013 17:53
-
-
Save xymox12/7516055 to your computer and use it in GitHub Desktop.
Event organiser - useful scripts
This file contains 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 $day_check = ''; /* Start the Loop */ ?> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<?php $day = eo_get_the_start('jS M Y'); | |
if ($day != $day_check) { | |
if ($day_check != '') { | |
echo '</ul>'; // close the list here | |
} | |
echo eo_get_the_start('jS M Y') . '<ul>'; | |
} | |
?> | |
<li><a href="<?php the_permalink() ?>"><?php the_time(); ?> <b><?php the_title(); ?></b></a></li> | |
<?php | |
$day_check = $day; ?> | |
<?php endwhile; ?> |
This file contains 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 | |
$events = eo_get_events(array( | |
//'numberposts'=>5, | |
'event_start_after'=>'today', | |
'showpastevents'=>true,//Will be deprecated, but set it to true to play it safe. | |
)); | |
if($events): | |
echo '<ul>'; | |
foreach ($events as $event): | |
//Check if all day, set format accordingly | |
$format = ( eo_is_all_day($event->ID) ? get_option('date_format') : get_option('date_format').' '.get_option('time_format') ); | |
printf( | |
'<li><a href="%s"> %s </a> on %s </li>', | |
get_permalink($event->ID), | |
get_the_title($event->ID), | |
eo_get_the_start($format, $event->ID,null,$event->occurrence_id) | |
); | |
endforeach; | |
echo '</ul>'; | |
endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment