add enddate field

This commit is contained in:
arlemp@selectel.ru
2021-11-20 15:17:37 +03:00
parent 3569512aa5
commit c15ec37abb
5 changed files with 70 additions and 5 deletions

View File

@@ -5,10 +5,17 @@
function calend_block($month, $year, $script=false){
if (strlen($month) == 1){
$str_month = "0$month";
}
else{
$str_month = "$month";
}
$find_sql = "
SELECT `post_id`
FROM `wp_postmeta`
WHERE `meta_key` = 'startevent' AND `meta_value` BETWEEN '$year-$month-01T00:00:00' AND '$year-$month-31T23:59:59'
WHERE `meta_key` = 'startevent' AND `meta_value` BETWEEN '$year-$str_month-01T00:00:00' AND '$year-$str_month-31T23:59:59'
";
@@ -54,7 +61,7 @@ function calend_block($month, $year, $script=false){
foreach ($posts as $post){
$eventdate = get_post_meta($post['ID'], 'startevent', true);
$key = date('d.m.Y', strtotime($eventdate));
$key = date('d.n.Y', strtotime($eventdate));
$events[$key]['text'] = $post['post_title'];
$events[$key]['link'] = get_permalink($post['ID']);

View File

@@ -31,7 +31,7 @@ class Calendar
$out = '
<div id="calendar-item">
<div class="calendar-title">Календарь событий</div>
<div class="calendar-title">Календарь мероприятий</div>
<div class="calendar-head">
<div class="calendar-prev"><a id="calendar-arrow-prev" onclick="load_calendar_month('."'prev'".');"><</a></div>
<div class="calendar-head-text">' . $months[$month] . ' ' . $year . '</div>

View File

@@ -9,6 +9,6 @@ require '/vhosts/beta/wp-load.php';
if (isset($_GET['month']) and $_GET['year']){
calend_block($_GET['month'], $_GET['year']);
calend_block(trim($_GET['month']), trim($_GET['year']));
}