我已使用Formidable Pro为组织设置了活动日历。我需要能够使用定期事件选项,但此选项支持的唯一显示是日历视图,日历视图显示为very skinny columns on smart devices - 不太好。
我添加了一些css并编辑了calendar.php文件中的代码以获取this:
我的css:
@media
only screen and (max-width: 1920px)
/*(min-device-width: 768px) and (max-device-width: 1024px)*/ {
.frmcal table.frmcal-calendar tbody tr td {
display:inline;
width:100%;
}
table.frmcal-calendar .frmcal_date {
padding: 6px 5px;
background-color: #dedad1;
}
table.frmcal-calendar .frmcal-today .frmcal_date {
padding: 6px 5px;
background-color: #dedad1;
text-align:center;
}
table.frmcal-calendar .frmcal_date {
text-align:center;
}
.frmcal-content {
padding:14px 12px;
}
}
我的更改前的代码:
<div class="frmcal_num"><?php echo $day ?></div></div> <div class="frmcal-content">
我的更改后的代码:
<div class="frmcal_num"><?php echo $day_names[$i], $month, ' / ', $day, ' / ', $year ?></div></div> <div class="frmcal-content”>
我想删除您在第一个图片链接中看到的日期名称(Sun,Mon,Tues,...),并将它们添加到日期的开头。我想将月份数转换为月份名称,以便显示如下:2015年8月3日星期一。
帮助?
calendar.php文件的完整代码。
<?php
for ( $i = $week_begins; $i < ( $maxday+$startday ); $i++ ) {
$pos = $i % 7;
$end_tr = false;
if ( $pos == $week_begins ) {
echo "<tr>\n";
}
$day = $i - $startday + 1;
//add classes for the day
$day_class = '';
//check for today
if ( isset( $today ) && $day == $today ) {
$day_class .= ' frmcal-today';
}
if ( $pos == $week_begins || $pos == $week_ends ) {
$day_class .= ' frmcal-week-end';
}
?>
<td<?php echo ( ! empty( $day_class ) ) ? ' class="' . esc_attr( $day_class ) . '"' : ''; ?>><div class="frmcal_date"><?php
echo isset($day_names[$i]) ? $day_names[$i] .' ' : '';
unset($day_class);
if ( $i >= $startday ) {
?><div class="frmcal_num"><?php echo $day ?></div></div> <div class="frmcal-content">
<?php
if ( isset($daily_entries[$i]) && ! empty($daily_entries[$i]) ) {
foreach ( $daily_entries[$i] as $entry ) {
//Set up current entry date for [event_date] shortcode
$current_entry_date = $year . '-' . $month . '-' . ( $day < 10 ? '0' . $day : $day );
if ( isset($used_entries[$entry->id]) ) {
$this_content = FrmProFieldsHelper::replace_calendar_date_shortcode($used_entries[$entry->id], $current_entry_date);
echo '<div class="frm_cal_multi_'. $entry->id .'">'. $this_content .'</div>';
} else {
// switch [event_date] to [calendar_date] so it can be replaced on each individual date instead of each entry
$new_content = str_replace( array( '[calendar_date]', '[calendar_date '), array( '[calendar_date]', '[calendar_date '), $new_content);
$this_content = apply_filters('frm_display_entry_content', $new_content, $entry, $shortcodes, $display, $show, '', array( 'calendar_date' => $current_entry_date));
$used_entries[$entry->id] = $this_content;
$this_content = FrmProFieldsHelper::replace_calendar_date_shortcode($this_content, $current_entry_date);
echo $this_content;
unset($this_content);
}
}
}
}
?></div>
</td>
<?php
if ( $pos == $week_ends ) {
$end_tr = true;
echo "</tr>\n";
}
}
$pos++;
if ( $pos == 7 ) {
$pos = 0;
}
if ( $pos != $week_begins ) {
if ( $pos > $week_begins ) {
$week_begins = $week_begins+7;
}
for ( $e=$pos; $e<$week_begins; $e++ ) {
echo "<td></td>\n";
}
}
if ( ! $end_tr ) {
echo '</tr>';
}