Small Calendar Widget – Exclude dates not in current month
-
Hello,
So I’m just going through and making some small changes to the way the small calendar widget is displayed. Basically I’d like the days to be listed horizontally in a straight forward list as opposed to in the calendar view/grid.
I have found calendar-small.php and created a copy within my theme so as not to modify the original source files.
Here’s a basic version of what I’ve got so far:
<div> <?php foreach($calendar['cells'] as $date => $cell_data ){ $class = ( !empty($cell_data['events']) && count($cell_data['events']) > 0 ) ? 'eventful':'eventless'; if(!empty($cell_data['type'])){ $class .= "-".$cell_data['type']; } ?> <ul> <?php if( !empty($cell_data['events']) && count($cell_data['events']) > 0 ): ?> <li><?php echo date('j',$cell_data['date']); ?></li> <?php else:?> <li><?php echo date('j',$cell_data['date']); ?></li> <?php endif; ?> </ul> <?php } ?> </div>
When doing a
print_r
of$calendar
I can see that there is the key “PRE” assigned to all dates that are not of the current month. I don’t suppose you could point me in the right direction on how I could use this to exclude those dates from my output so that only the dates within the current month are displayed (Both pre and post)?It’s also my intention to add 3 letter days to each of those dates i.e. M = MON, T = TUE etc
You guys have done a great job at the plugin already and I don’t expect you to do everything for me, but a signal in the right direction would be much appreciated
Thanks in advance
- The topic ‘Small Calendar Widget – Exclude dates not in current month’ is closed to new replies.