From cbefa787b18fe536a901a6386f83c75528102af8 Mon Sep 17 00:00:00 2001 From: AK Delfin Date: Mon, 11 Oct 2021 22:29:11 +0300 Subject: [PATCH] add fix problem --- blocks/mainnews.php | 35 ++++++ blocks/moread.php | 2 +- blocks/mosts.php | 2 +- blocks/opinion.php | 6 +- category.php | 2 + footer.php | 12 +- functions.php | 105 +++++++++++++++++ header.php | 13 +- index.php | 70 +++++------ rsscreate.php | 30 +++++ single.php | 2 +- style.css | 31 +++-- views/mailsub.php | 274 +++++++++++++++++++++++++++++++++++++++++++ views/rss/yanews.php | 29 +++++ 14 files changed, 553 insertions(+), 60 deletions(-) create mode 100644 blocks/mainnews.php create mode 100644 rsscreate.php create mode 100644 views/mailsub.php create mode 100644 views/rss/yanews.php diff --git a/blocks/mainnews.php b/blocks/mainnews.php new file mode 100644 index 0000000..5765a2d --- /dev/null +++ b/blocks/mainnews.php @@ -0,0 +1,35 @@ + -1, // нужно для отображения всех постов, без разделения по страницам + 'post__in' => get_option( 'sticky_posts' ), + 'posts_per_page' => 1 +); + +$q = new WP_Query( $params ); + +if ( $q->have_posts() ) : + $q->the_post(); + $mainpost_id = get_the_ID(); +?> + +
+ + +
+ <?the_title();?> +
+ + +

+
+
+
+
+ +
+ + + + + 4, - 'category' => 22, // пока тольео события + 'category' => 2, // пока тольео события 'orderby' => 'date', 'order' => 'DESC', 'include' => array(), diff --git a/blocks/mosts.php b/blocks/mosts.php index 4b20643..abbdf75 100644 --- a/blocks/mosts.php +++ b/blocks/mosts.php @@ -6,7 +6,7 @@ $mosts = get_posts( array( 'numberposts' => 3, - 'category' => 22, // пока без категории + 'category' => 2, // пока без категории 'orderby' => 'date', 'order' => 'DESC', 'include' => array(), diff --git a/blocks/opinion.php b/blocks/opinion.php index 85e4420..9d67a55 100644 --- a/blocks/opinion.php +++ b/blocks/opinion.php @@ -5,7 +5,7 @@ $key = 'vij_opinions'; if (!$opinions = kuri_set($key)) { $opinions = get_posts( array( 'numberposts' => 1, - 'category' => 30, // 7 - мнения + 'category' => 8, // 7 - мнения 'orderby' => 'date', 'order' => 'DESC', 'include' => array(), @@ -25,8 +25,8 @@ if(is_array($opinions)): $post = $opinions[0];?>
-
мнение
- <?=$post->post_title;?> + + <?=$post->post_title;?>
diff --git a/category.php b/category.php index 7acbf9d..adc8ae3 100644 --- a/category.php +++ b/category.php @@ -10,6 +10,8 @@ $nn = 0;?>
+ +
+
+ + + +
'']);?> @@ -90,7 +95,8 @@ Ветеринария и жизнь. Газета и сайт diff --git a/functions.php b/functions.php index afd056c..d123910 100644 --- a/functions.php +++ b/functions.php @@ -15,6 +15,7 @@ add_theme_support('post-thumbnails'); # регистрируем размеры миниатюр add_image_size( 'left-thumb', 95, 84, true ); # для левой колонки add_image_size( 'moread', 372, 216, true ); # читайте также +add_image_size( 'subscripts', 198, 145, true ); # рассылка #add scripts @@ -69,4 +70,108 @@ function kuri_set($name = null, $value = null) { $vars[$name] = $value; return false; +} + +# время для rss +function _U2RFC822($date) { + + $datatime = explode(" ",$date); + $dater = explode("-",$datatime[0]); + $timer = explode(":",$datatime[1]); + + return date('r', mktime($timer[0], $timer[1], $timer[2], $dater[1], $dater[2], $dater[0])); +} + + +add_action( 'save_post', 'prefix_save_post' ); + +function prefix_save_post( $post_id ){ + + if ($post_id < 15765) + return; // старье не трогаем + + if ( wp_is_post_revision( $post_id )) + return; + + remove_action( 'save_post_insert', 'prefix_save_post' ); + + $post = get_posts($post_id); + $name = $post[0]->post_name; +// $newname = vij_slug($name); + + file_put_contents("/vhosts/logs/translit.log", "$post_id: $name\n", FILE_APPEND); + + +} + + + + +function vij_slug($slug) { + $replace = array( + 'А' => 'A', 'а' => 'a', + 'Б' => 'B', 'б' => 'b', + 'В' => 'V', 'в' => 'v', + 'Г' => 'G', 'г' => 'g', + 'Д' => 'D', 'д' => 'd', + 'Е' => 'E', 'е' => 'e', + 'Ё' => 'Jo', 'ё' => 'jo', + 'Ж' => 'Zh', 'ж' => 'zh', + 'З' => 'Z', 'з' => 'z', + 'И' => 'I', 'и' => 'i', + 'Й' => 'J', 'й' => 'j', + 'К' => 'K', 'к' => 'k', + 'Л' => 'L', 'л' => 'l', + 'М' => 'M', 'м' => 'm', + 'Н' => 'N', 'н' => 'n', + 'О' => 'O', 'о' => 'o', + 'П' => 'P', 'п' => 'p', + 'Р' => 'R', 'р' => 'r', + 'С' => 'S', 'с' => 's', + 'Т' => 'T', 'т' => 't', + 'У' => 'U', 'у' => 'u', + 'Ф' => 'F', 'ф' => 'f', + 'Х' => 'H', 'х' => 'h', + 'Ц' => 'C', 'ц' => 'c', + 'Ч' => 'Ch', 'ч' => 'ch', + 'Ш' => 'Sh', 'ш' => 'sh', + 'Щ' => 'Shh', 'щ' => 'shh', + 'Ъ' => '', 'ъ' => '', + 'Ы' => 'Y', 'ы' => 'y', + 'Ь' => '', 'ь' => '', + 'Э' => 'E', 'э' => 'e', + 'Ю' => 'Ju', 'ю' => 'ju', + 'Я' => 'Ya', 'я' => 'ya' + ); + + $newslug = strtr($slug, $replace); + + + + + return $newslug; + + //return strtr($slug, $replace); + + +} + + + + +function view ($view, $data = array(), $layer = null){ + + ob_start(); + + if (is_array($data)) + extract($data); + if ($layer !== null){ + $content = view($view, $data); + require $layer; + } + else + require $view; + + return trim(ob_get_clean()); + } \ No newline at end of file diff --git a/header.php b/header.php index c501621..bc4a50e 100644 --- a/header.php +++ b/header.php @@ -3,11 +3,20 @@ - <?php wp_title('|', true, 'right');?> - + <?php wp_title('|', true, 'right');?><?=get_bloginfo('name')?> + + + ID)):?> + + ID); + $thumb_url = wp_get_attachment_image_src($thumb_id,'large', false);?> + + + diff --git a/index.php b/index.php index 8a1dce6..ce4c490 100644 --- a/index.php +++ b/index.php @@ -7,11 +7,19 @@ get_header(); $nn = 0;?> - + + + +
+ +

Главное

+ + array(2), + 'post__not_in' => array($mainpost_id), 'meta_query' => array( array( 'key' => '_thumbnail_id', @@ -22,54 +30,30 @@ $nn = 0;?> ); # фильтруем рубрики ?> -
+have_posts()) : ?> + -

Главное

+
-have_posts()) : while($query->have_posts()) : $query->the_post();?> + have_posts()) : $query->the_post();?> - - - - -
- - -
- <?the_title();?> -
- - -

-
-
-
-
-
- - -
- - - 1):?> - -
- -
- <?the_title();?> + +
+ +
+ <?the_title();?> +
+ +

+
+
- -

-
-
-
-
- - +
+ -
+
@@ -81,6 +65,8 @@ $nn = 0;?> 'mob-lite']);?> 'mob-lite']);?> + +
diff --git a/rsscreate.php b/rsscreate.php new file mode 100644 index 0000000..673557f --- /dev/null +++ b/rsscreate.php @@ -0,0 +1,30 @@ + 20, + 'category' => 2, + 'orderby' => 'date', + 'order' => 'DESC', + 'include' => array(), + 'exclude' => array(), + 'meta_key' => '', + 'meta_value' =>'', + 'post_type' => 'post', + 'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса +)); + +if( $posts ){ + + include('views/rss/yanews.php'); + +} + + + + diff --git a/single.php b/single.php index c44a4d7..b6331d3 100644 --- a/single.php +++ b/single.php @@ -66,7 +66,7 @@ - +
diff --git a/style.css b/style.css index 413c050..2419fae 100644 --- a/style.css +++ b/style.css @@ -132,6 +132,13 @@ a{ width: 340px; } + .right-info{ + margin-top: 8px; + margin-bottom: 12px; + text-align: center; + width: 100%; + } + .wrap{ transform: translate(0%, 0%); width: 0px; @@ -146,6 +153,8 @@ a{ /* margin-top: 55px; margin-left: 35px;*/ } + + .input{ border: 0; @@ -502,6 +511,8 @@ a{ font-size: 12px; } + + article{ padding: 1em; } @@ -808,9 +819,10 @@ a{ .left_preview{ - border-radius: 50%; - width: 95px; - height: 84px; + /*border-radius: 50%;*/ + /*width: 105px; + height: 84px;*/ + width: 145px; } .publ_expert{ @@ -871,13 +883,14 @@ a{ .left_opinion img{ margin-top: 8px; margin-bottom: 8px; - width: 84px; - height: 84px; + /*width: 84px; + height: 84px;*/ } .left_opinion_title{ margin-bottom: 8px; font-weight: bold; + text-transform: uppercase; } .left_opinion_text{ @@ -1124,8 +1137,10 @@ a{ text-align: center; text-decoration: none; display: inline-block; + cursor: pointer; font-size: 16px; font-size: 11px; + } @@ -1231,6 +1246,7 @@ img-fluid{ } + .main-card-title{ font-size: 24px; } @@ -1396,7 +1412,9 @@ img-fluid{ width: 100%; } - + .fulltext IMG{ + width: 100%; + } #footer{ width: 100%; @@ -1406,7 +1424,6 @@ img-fluid{ display: none; } - } diff --git a/views/mailsub.php b/views/mailsub.php new file mode 100644 index 0000000..c138bf6 --- /dev/null +++ b/views/mailsub.php @@ -0,0 +1,274 @@ + + + + + <?=$title?> + + + + + + + + + + diff --git a/views/rss/yanews.php b/views/rss/yanews.php new file mode 100644 index 0000000..2fc77e8 --- /dev/null +++ b/views/rss/yanews.php @@ -0,0 +1,29 @@ +';?> + + + Новости с сайта www.vetandlife.ru + https://www.vetandlife.ru + Новости с сайта www.vetandlife.ru + + + <?=htmlspecialchars($post->post_title)?> + ID);?> + post_excerpt);?> + ID);?> + События + ID);?> + + + + ID)):?> + + + post_date)?> + post_content)?> + ]]> + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + + + +
  + + + + + + + + + + + + + +
  +
+ + <?=$logoname?> + + + + + + + +
+ ГЛАВНОЕ ЗА  +
+
  +
+
 
+
+ + + + + + +
  +
+ + + + + +
  + + + + + + + + + + + + + + + + + +
+
+ ID)):?> + + <?=$item->post_title?> + + +
+
+ + + + + + + +
  + + + + + + + + + + + + +
+ post_title?> +
 
+ +
+
+
 
 
 
+ +
 
+ + + + + + + + + +
 
+ + + + + + + + +
+ БОЛЬШЕ НОВОСТЕЙ +
+
+ + + + + + + + + + +
 
+ + + + + + + + + +
+ ПОДПИСАТЬСЯ +
 
+
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+
+
 
+ +
 
+ + + + + + + + +
  + + +  
+
 
 
+ + + + + + + +
  + +
+
 
+
© «Ветеринария и жизнь», vetandlife.ru
+
 
+
+
+