diff --git a/blocks/events.php b/blocks/events.php index b9b6e33..20d08ab 100644 --- a/blocks/events.php +++ b/blocks/events.php @@ -5,17 +5,11 @@ $posts = get_posts( array( 'numberposts' => 3, 'category' => 61, // 61 - мероприятия - 'orderby' => 'date', + 'orderby' => 'meta_value', 'order' => 'ASC', - - 'date_query' => array( - array( - 'after' => '3 days ago', - ), - ), - + 'meta_query' => array(array('key' => 'startevent')), 'post_type' => 'post', - 'post_status' => 'publish, future', + //'post_status' => 'publish, future', 'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса ) ); @@ -29,7 +23,8 @@ if( $posts ):?> ?>
-
+ ID, 'startevent', true );?> +
@@ -39,4 +34,4 @@ if( $posts ):?> +
+ + +
+ + 'mob-lite']);?> 'mob-lite']);?> 'mob-lite']);?> -
Показать ещe
diff --git a/single.php b/single.php index b6331d3..3d181f0 100644 --- a/single.php +++ b/single.php @@ -66,21 +66,15 @@ -
<   На главную
+
+ +
+ - - - - - - - - - - diff --git a/src/calend-block.php b/src/calend-block.php index d6112cc..b30b095 100644 --- a/src/calend-block.php +++ b/src/calend-block.php @@ -1,43 +1,65 @@ -1, 'category' => 61, // 61 - мероприятия - 'orderby' => 'date', - 'order' => 'ASC', - - 'date_query' => array( + 'meta_query' => array( array( - 'after' => array( // после этой даты - 'year' => $year, - 'month' => $month, - 'day' => 1, - ), - 'before' => array( // до этой даты - 'year' => $year, - 'month' => $month, - 'day' => 31, - ), - // 'inclusive'=> true - ) - ), - + 'key' => 'startevent', + 'value' => array( "$year-$month-01T00:00:00", "$year-$month-31T23:59:59" ), + 'compare' => 'BETWEEN', + 'type' => 'DATE' + ), + ), 'post_type' => 'post', - 'post_status' => 'publish, future', 'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса + );*/ + + $args = array( + 'numberposts' => -1, + 'post__in' => $ins ); - $posts = get_posts($args); + //$posts = get_posts($args); $events = []; - foreach ($posts as $post){ - $key = date('d.m.Y', strtotime($post->post_date)); - $events[$key]['text'] = $post->post_title; - $events[$key]['link'] = get_permalink($post->ID); + if (is_array($posts)){ + foreach ($posts as $post){ + $eventdate = get_post_meta($post['ID'], 'startevent', true); + $key = date('d.m.Y', strtotime($eventdate)); + $events[$key]['text'] = $post['post_title']; + $events[$key]['link'] = get_permalink($post['ID']); + + } + }?>
diff --git a/src/calendar.php b/src/calendar.php index 7e05f3f..c4e031b 100644 --- a/src/calendar.php +++ b/src/calendar.php @@ -9,7 +9,9 @@ class Calendar */ public static function getMonth($month, $year, $events = array()) { - $months = array( + + + $months = array( 1 => 'Январь', 2 => 'Февраль', 3 => 'Март', @@ -67,7 +69,7 @@ class Calendar $class = ''; } - $event_show = false; + /** $event_show = false; $event_text = ''; $event_link = ''; if (!empty($events)) { @@ -96,14 +98,24 @@ class Calendar $event_link = $text['link']; } } - } + } */ + + if ($day < 10) + $day_str = "0$day"; + else + $day_str = $day; + + $arr_key = "$day_str.$month.$year"; + + - if ($event_show) { + //if ($event_show) { + if (isset($events[$arr_key])) { + $out.= ''; - if (!empty($event_text)) { - $out.= '
'.$day.'
'; - } + $out.= '
'.$day.'
'; + $out.= ''; } else { $out.= '' . $day . ''; diff --git a/style.css b/style.css index fd76d72..9a2c37a 100644 --- a/style.css +++ b/style.css @@ -387,6 +387,26 @@ a{ height: 55px; } + .more_button { + background: #FFFFFF; + box-sizing: border-box; + border-radius: 47px; + border: 1px solid #171717; + color: #171717; + padding: 10px 28px; + text-align: center; + text-decoration: none; + text-transform: uppercase; + font-weight: bold; + display: inline-block; + font-size: 16px; + font-size: 11px; + line-height: 110%; + height: 45px; + margin-top: 22px; + + } + .vazh{ font-size: 9px; text-transform: uppercase;