diff --git a/blocks/archive.php b/blocks/archive.php index 431009e..59b3107 100644 --- a/blocks/archive.php +++ b/blocks/archive.php @@ -23,7 +23,7 @@ if( $posts ):
<?the_title();?>
Читать газету
«Ветеринария и Жизнь»
- +
diff --git a/blocks/events.php b/blocks/events.php index bef9d41..b9b6e33 100644 --- a/blocks/events.php +++ b/blocks/events.php @@ -1,4 +1,4 @@ - 3, 'category' => 61, // 61 - мероприятия 'orderby' => 'date', - 'order' => 'DESC', - 'include' => array(), - 'exclude' => array(), - 'meta_key' => '', - 'meta_value' =>'', + 'order' => 'ASC', + + 'date_query' => array( + array( + 'after' => '3 days ago', + ), + ), + 'post_type' => 'post', + 'post_status' => 'publish, future', 'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса ) ); diff --git a/blocks/mosts.php b/blocks/mosts.php index abbdf75..6805d6e 100644 --- a/blocks/mosts.php +++ b/blocks/mosts.php @@ -6,7 +6,7 @@ $mosts = get_posts( array( 'numberposts' => 3, - 'category' => 2, // пока без категории + 'post__in' => get_option( 'sticky_posts' ), 'orderby' => 'date', 'order' => 'DESC', 'include' => array(), diff --git a/category-votes.php b/category-votes.php new file mode 100644 index 0000000..2a734f5 --- /dev/null +++ b/category-votes.php @@ -0,0 +1,89 @@ + + + +
+ + + +

+ + +
+ + + + +
+ + + + + <?the_title();?> + + +
+ + + +
+
+
+ + + + +

Спасибо за Ваш голос

+ + + +
+ $curr_id?> +
+ + +
+
+
+ +
+ + + + +
+ + + + + + + + + Здесь пока нет публикаций + + + + +
+ + \ No newline at end of file diff --git a/category.php b/category.php index adc8ae3..81c8ae7 100644 --- a/category.php +++ b/category.php @@ -14,7 +14,7 @@ $nn = 0;?> diff --git a/footer.php b/footer.php index fc945e3..ad2a0a2 100644 --- a/footer.php +++ b/footer.php @@ -21,6 +21,20 @@ '']);?> +
+ + + +
+ +
+ + + +
+ + + @@ -59,11 +73,21 @@
- - + + Сделано честно
+
+ + + +
+
+ + + +
'']);?> diff --git a/functions.php b/functions.php index d123910..539f719 100644 --- a/functions.php +++ b/functions.php @@ -1,6 +1,11 @@ post_status != 'publish' ) + return; $post = get_posts($post_id); - $name = $post[0]->post_name; -// $newname = vij_slug($name); + $name = urldecode($post[0]->post_name); - file_put_contents("/vhosts/logs/translit.log", "$post_id: $name\n", FILE_APPEND); + if (isContainsRussianLetters($name)) { //если есть русские буковки + $title = express_slug($post[0]->post_title); + $latname = vij_slug($title); + remove_action( 'save_post', 'lat_slug' ); // избегаем зацикливания + wp_update_post( array( 'ID' => $post_id, 'post_name' => $latname ) ); + add_action( 'save_post', 'lat_slug' ); + } } - - - function vij_slug($slug) { $replace = array( @@ -144,22 +155,100 @@ function vij_slug($slug) { 'Я' => 'Ya', 'я' => 'ya' ); - $newslug = strtr($slug, $replace); - - - - - return $newslug; - //return strtr($slug, $replace); + return strtr($slug, $replace); } +function isContainsRussianLetters($text = false) { + if ($text !== "") { + $len = strlen($text)-1; + for ($i=0;$i<=$len;$i++) { + if (($i < $len) and (((($ord = ord(substr($text,$i,1))) == 208) + and (($ord2 = ord(substr($text,($i+1),1))) == 129) + or (($ord2 >= 144) and ($ord2 <= 191))) + or ((($ord = ord(substr($text,$i,1))) == 209) + and ($ord2 == 145) or (($ord2 >= 128) + and ($ord2 <= 143))))) { + //Поиск русских букв в UTF-8 + return true; + } elseif (((($ord = ord(substr($text,$i,1))) >= 192) + and (($ord <= 255)) or ($ord == 168) or ($ord == 184))) { + //Поиск русских букв в ANSI + return true; + } + } + } + return false; + } -function view ($view, $data = array(), $layer = null){ + function express_slug($value){ + + + $result = mb_strtolower(trim($value)); + + $arr = [ +'$' => '', +' ' => '-', +'.' => '', +'+' => '', +'!' => '', +'*' => '', +'(' => '', +')' => '', +',' => '-', +'{' => '', +'}' => '', +'|' => '-', +'^' => '', +'~' => '', +'[' => '-', +']' => '-', +'`' => '', +'<' => '', +'>' => '', +'#' => '', +'%' => '', +'"' => '', +';' => '', +'/' => '', +'?' => '', +':' => '', +'@' => '', +'&' => '', +'=' => '', +'.' => '', +'«' => '', +'»' => '', +"'"=> '' +]; + + $result = strtr($result, $arr); + + return $result; + +} + + +function eventdate($val){ + $posT = strpos($val, 'T'); + + if ($posT) + + return $val; +} + + + +/** + * + */ + +if (!function_exists('view')){ + function view ($view, $data = array(), $layer = null){ ob_start(); @@ -174,4 +263,5 @@ function view ($view, $data = array(), $layer = null){ return trim(ob_get_clean()); -} \ No newline at end of file + } +} \ No newline at end of file diff --git a/header.php b/header.php index bc4a50e..9c07ccc 100644 --- a/header.php +++ b/header.php @@ -4,13 +4,15 @@ <?php wp_title('|', true, 'right');?><?=get_bloginfo('name')?> - + + + ID)):?> - + ID); $thumb_url = wp_get_attachment_image_src($thumb_id,'large', false);?> @@ -30,7 +32,7 @@
-
+
diff --git a/src/calend-block.php b/src/calend-block.php new file mode 100644 index 0000000..d6112cc --- /dev/null +++ b/src/calend-block.php @@ -0,0 +1,104 @@ + -1, + 'category' => 61, // 61 - мероприятия + 'orderby' => 'date', + 'order' => 'ASC', + + 'date_query' => array( + array( + 'after' => array( // после этой даты + 'year' => $year, + 'month' => $month, + 'day' => 1, + ), + 'before' => array( // до этой даты + 'year' => $year, + 'month' => $month, + 'day' => 31, + ), + // 'inclusive'=> true + ) + ), + + 'post_type' => 'post', + 'post_status' => 'publish, future', + 'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса + ); + + $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); + + }?> + +
+ +
+ + + + + 'Январь', + 2 => 'Февраль', + 3 => 'Март', + 4 => 'Апрель', + 5 => 'Май', + 6 => 'Июнь', + 7 => 'Июль', + 8 => 'Август', + 9 => 'Сентябрь', + 10 => 'Октябрь', + 11 => 'Ноябрь', + 12 => 'Декабрь' + ); + + $month = intval($month); + + + $out = ' +
+
Календарь событий
+
+ +
' . $months[$month] . ' ' . $year . '
+ +
+ + + + + + + + + + '; + + $day_week = date('N', mktime(0, 0, 0, $month, 1, $year)); + $day_week--; + + $out.= ''; + + for ($x = 0; $x < $day_week; $x++) { + $out.= ''; + } + + $days_counter = 0; + $days_month = date('t', mktime(0, 0, 0, $month, 1, $year)); + + for ($day = 1; $day <= $days_month; $day++) { + if (date('j.n.Y') == $day . '.' . $month . '.' . $year) { + $class = 'today'; + } elseif (time() > strtotime($day . '.' . $month . '.' . $year)) { + $class = 'last'; + } else { + $class = ''; + } + + $event_show = false; + $event_text = ''; + $event_link = ''; + if (!empty($events)) { + foreach ($events as $date => $text) { + $date = explode('.', $date); + if (count($date) == 3) { + $y = explode(' ', $date[2]); + if (count($y) == 2) { + $date[2] = $y[0]; + } + + if ($day == intval($date[0]) && $month == intval($date[1]) && $year == $date[2]) { + $event_show = true; + $event_text = $text['text']; + $event_link = $text['link']; + } + } elseif (count($date) == 2) { + if ($day == intval($date[0]) && $month == intval($date[1])) { + $event_show = true; + $event_text = $text['text']; + $event_link = $text['link']; + } + } elseif ($day == intval($date[0])) { + $event_show = true; + $event_text = $text['text']; + $event_link = $text['link']; + } + } + } + + if ($event_show) { + + $out.= ''; + } else { + $out.= ''; + } + + if ($day_week == 6) { + $out.= ''; + if (($days_counter + 1) != $days_month) { + $out.= ''; + } + $day_week = -1; + } + + $day_week++; + $days_counter++; + } + + $out .= '
ПнВтСрЧтПтСбВс
'; + if (!empty($event_text)) { + $out.= ''; + } + $out.= '' . $day . '
'; + return $out; + } + + /** + * Вывод календаря на несколько месяцев. + */ + public static function getInterval($start, $end, $events = array()) + { + $curent = explode('.', $start); + $curent[0] = intval($curent[0]); + + $end = explode('.', $end); + $end[0] = intval($end[0]); + + $begin = true; + $out = '
'; + do { + $out .= self::getMonth($curent[0], $curent[1], $events); + + if ($curent[0] == $end[0] && $curent[1] == $end[1]) { + $begin = false; + } + + $curent[0]++; + if ($curent[0] == 13) { + $curent[0] = 1; + $curent[1]++; + } + } while ($begin == true); + + $out .= '
'; + return $out; + } +} \ No newline at end of file diff --git a/src/eventcalendar.php b/src/eventcalendar.php new file mode 100644 index 0000000..e5a2e06 --- /dev/null +++ b/src/eventcalendar.php @@ -0,0 +1,14 @@ + ul{ + list-style: square outside; + } + + .fulltext > ul li{ + + margin-top: 4px; + margin-bottom: 4px; + + } + + .wp-block-image figcaption { + font-size: .9em; + } + + figcaption { + + /*font-size: .9em;*/ + color: #909294; + text-align: center; + padding: 12px 0 12px 0; + + } + .sp-button{ color: orange; } + #fulltext img, + .wp-block-image img + { + width: 100%; + height: auto; + } + + blockquote{ + font-weight: bold; + text-align: center; + padding-top: 8px; + padding-left: 8px; + margin-top: 22px; + margin-bottom: 22px; + border-top: 1px solid #E9EAEB; + border-bottom: 1px solid #E9EAEB; + + } /** - menus -- */ ul.menu_main{ @@ -591,9 +636,16 @@ a{ } #content IMG{ - max-width: 700px; + max-width: 100%; + } + .wp-block-image IMG{ + /** object-fit: cover; */ + + } + + #post-img{ text-align: center; /**background: #F5F5F5;*/ @@ -831,6 +883,10 @@ a{ margin-bottom: 18px; } +.publ_expert a{ + color: #2D9CDB; +} + .post_info{ font-size: 14px; color: #444444; @@ -958,11 +1014,17 @@ a{ .right_archive{ margin-bottom: 22px; + background: #FFFFFF; + box-shadow: 0px 14px 27px rgb(242, 242, 242); text-align: center; + margin: 22px; + padding-top: 22px; + padding-bottom: 22px; } .right_archive_img{ margin-bottom: 12px; + width: 202px; } .right_archive_text{ @@ -977,6 +1039,8 @@ a{ font-size: 15px; line-height: 130%; text-align: center; + margin-top: 8px; + margin-bottom: 8px; } .right_archive_link a{ @@ -1144,8 +1208,85 @@ a{ } +#calendar-item{ + background-color: #2571A6; + color: rgba(255, 255, 255, 0.28); + text-transform: uppercase; + box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.07); + font-size: 13px; + padding: 22px; +} + +.calendar-head { + display: flex; + text-align: center; + font-size: 12px; + color: #FFFFFF; + font-weight: bold; + margin-bottom: 12px; +} + + .calendar-head a{ + color: #FFFFFF; + } + + + #calendar-arrow-prev, + #calendar-arrow-next { + cursor: pointer; + } + +.calendar-title{ + text-align: center; + font-size: 12px; + color: #FFFFFF; + font-weight: bold; + margin-bottom: 20px; + +} + +#calendar-item th { + font-size: 10px; + padding: 6px 7px; + text-align: center; + color: #FFFFFF; + font-weight: bold; + line-height: 14px; +} + +#calendar-item td { + font-size: 13px; + padding: 6px 8px; + text-align: center; + +} + +.calendar-item table { + border-collapse: collapse; + width: 100%; +} + +.calendar-head{ + border-top: 1px solid rgba(0, 70, 106, 0.18); + border-bottom: 1px solid rgba(0, 70, 106, 0.18); + padding-top: 12px; + padding-bottom: 12px; +} + + +.calendar-popup a{ + color: #FFFFFF; +} + + + +.calendar-head-text{ + margin-right: 12px; + margin-left: 12px; + width: 90%; + text-align: center; +} -/** socials */ #socials{ display: flex; @@ -1364,6 +1505,9 @@ img-fluid{ text-align: center; } + .mobile-info{ + display: block; + } @@ -1412,8 +1556,8 @@ img-fluid{ width: 100%; } - .fulltext IMG{ - width: 100%; + .fulltext > IMG{ + max-width: 100%; } #footer{ @@ -1437,6 +1581,9 @@ and (max-device-width : 667px) { width: 100%; } + .mobile-info{ + display: block; + } .mini-card{ diff --git a/views/mailsub.php b/views/mailsub.php index c138bf6..9758968 100644 --- a/views/mailsub.php +++ b/views/mailsub.php @@ -79,9 +79,9 @@
- ID)):?> - - <?=$item->post_title?> + + + <?=$item['post_title']?>
@@ -96,14 +96,14 @@ - post_title?> +   - +