• Hello,

    I have tried editing my php template file with no luck. Can anyone give me tips on how to make the category colours show on the small calendar.

    This is my small calendar php code:

    <table class=”em-calendar”>
    <thead>
    <tr>
    <td>” rel=”nofollow”><<</td>
    <td class=”month_name” colspan=”5″><?php echo ucfirst(date_i18n(get_option(‘dbem_small_calendar_month_format’), $calendar[‘month_start’])); ?></td>
    <td>” rel=”nofollow”>>></td>
    </tr>
    </thead>
    <tbody>
    <tr class=”days-names”>
    <td><?php echo implode(‘</td><td>’,$calendar[‘row_headers’]); ?></td>
    </tr>
    <tr>
    <?php
    $cal_count = count($calendar[‘cells’]);
    $col_count = $count = 1; //this counts collumns in the $calendar_array[‘cells’] array
    $col_max = count($calendar[‘row_headers’]); //each time this collumn number is reached, we create a new collumn, the number of cells should divide evenly by the number of row_headers
    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’];
    }
    ?>
    <td class=”<?php echo $class; ?>” style=”background-color:<?php
    if ( !empty($cell_data[‘events’]) ){
    foreach( $cell_data[‘events’] as $EM_Event ){
    echo $category_color = $EM_Event->output(“#_CATEGORYCOLOR”);
    }
    }
    ?>”>
    ” title=”<?php echo esc_attr($cell_data[‘link_title’]); ?>”><?php echo date(‘j’,$cell_data[‘date’]); ?>
    <?php else:?>
    <?php echo date(‘j’,$cell_data[‘date’]); ?>
    <?php endif; ?>
    </td>
    <?php
    //create a new row once we reach the end of a table collumn
    $col_count= ($col_count == $col_max ) ? 1 : $col_count+1;
    echo ($col_count == 1 && $count < $cal_count) ? ‘</tr><tr>’:”;
    $count ++;
    }
    ?>
    </tr>
    </tbody>
    </table>

  • The topic ‘Event Manager: category colors in calendar-small.php file’ is closed to new replies.