add turbo
This commit is contained in:
@@ -37,7 +37,7 @@ else{
|
|||||||
<div class="mob_menu_info">
|
<div class="mob_menu_info">
|
||||||
<?php include get_template_directory().'/blocks/mobile-gazeta.php';?>
|
<?php include get_template_directory().'/blocks/mobile-gazeta.php';?>
|
||||||
<?php include get_template_directory().'/blocks/mobile-subscript.php';?>
|
<?php include get_template_directory().'/blocks/mobile-subscript.php';?>
|
||||||
<?php include get_template_directory().'/blocks/social-buttons.php';?>
|
<?php include get_template_directory().'/blocks/social-buttons-pets.php';?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php /**wp_nav_menu( array(
|
<?php /**wp_nav_menu( array(
|
||||||
|
|||||||
13
blocks/social-buttons-pets.php
Normal file
13
blocks/social-buttons-pets.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<div id="socials">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://vk.com/pitomcy_vetandlife" target="_blank"><i style="color: #3B83B5;" class="fab fa-vk btn_soc"></i></a>
|
||||||
|
<a href="https://t.me/pitomcy_vetandlife" target="_blank"><i style="color: #3B83B5;" class="fab fa-telegram-plane btn_soc"></i></a>
|
||||||
|
<a href="https://www.youtube.com/channel/UCGRWr7wG8zxFBMMKdPzYPUQ" target="_blank"><i style="color: red;" class="fab fa-youtube btn_soc"></i></a>
|
||||||
|
|
||||||
|
<!-- <div class="btn soc_vk"></div>
|
||||||
|
<div class="soc_btn soc_fb"></div>
|
||||||
|
<div class="soc_btn soc_telegram"></div>
|
||||||
|
<div class="soc_btn soc_youtube"></div>
|
||||||
|
<div class="soc_btn soc_instagram"></div> -->
|
||||||
|
</div>
|
||||||
@@ -65,7 +65,7 @@ body {
|
|||||||
max-width: 200px;
|
max-width: 200px;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
margin: 0 0 0 22px;
|
margin: 0 0 0 2%;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,9 +218,31 @@ ul.pets-menu-left{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@media (max-width: 375px) {
|
||||||
|
|
||||||
|
#petslogo{
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 0 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pets-dog{
|
||||||
|
width: 133px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@media (max-width: 767px) {
|
@media (max-width: 767px) {
|
||||||
|
|
||||||
|
body{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.toggle-nav-pets {
|
.toggle-nav-pets {
|
||||||
background: url(/wp-content/themes/vij/pub/icons/gumburger.svg) no-repeat;
|
background: url(/wp-content/themes/vij/pub/icons/gumburger.svg) no-repeat;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
|
|||||||
143
rsscreate.php
143
rsscreate.php
@@ -1,57 +1,82 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
include_once '/vhosts/vetandlife.ru/wp-load.php';
|
include_once '/vhosts/vetandlife.ru/wp-load.php';
|
||||||
|
|
||||||
function filterHtml($html) {
|
|
||||||
|
|
||||||
$html = trim($html);
|
|
||||||
$html = preg_replace('/(\>)\s*(\<)/m', '$1$2', $html);
|
|
||||||
return preg_replace('/<!--(.*?)-->/', '', $html);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
date_default_timezone_set('Europe/Moscow');
|
date_default_timezone_set('Europe/Moscow');
|
||||||
|
|
||||||
$posts = get_posts( array(
|
|
||||||
'numberposts' => 20,
|
|
||||||
'category' => 2,
|
|
||||||
'orderby' => 'date',
|
|
||||||
'order' => 'DESC',
|
|
||||||
'include' => array(),
|
|
||||||
'exclude' => array(),
|
|
||||||
'meta_key' => '',
|
|
||||||
'meta_value' =>'',
|
|
||||||
'post_type' => 'post',
|
|
||||||
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
|
|
||||||
));
|
|
||||||
|
|
||||||
|
//Яндекс Новости
|
||||||
|
create_rss_yandex();
|
||||||
|
|
||||||
// Яндекс Новости
|
//Дзен
|
||||||
create_rss_file($posts, 'views/rss/yanews.php', '/vhosts/vetandlife.ru/rss/yanews.xml');
|
create_rss_dzen();
|
||||||
|
|
||||||
// Общая лента
|
|
||||||
create_rss_file($posts, 'views/rss/rssnews.php', '/vhosts/vetandlife.ru/rss/news.xml');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
if( $posts ){
|
|
||||||
|
function create_rss_yandex(){
|
||||||
|
|
||||||
|
$posts = get_posts( array(
|
||||||
|
'numberposts' => 20,
|
||||||
|
'category' => 2,
|
||||||
|
'orderby' => 'date',
|
||||||
|
'order' => 'DESC',
|
||||||
|
'include' => array(),
|
||||||
|
'exclude' => array(),
|
||||||
|
'meta_key' => '',
|
||||||
|
'meta_value' =>'',
|
||||||
|
'post_type' => 'post',
|
||||||
|
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Яндекс Новости
|
||||||
|
create_rss_file($posts, 'views/rss/yanews.php', '/vhosts/vetandlife.ru/rss/yanews.xml');
|
||||||
|
|
||||||
|
// Общая лента
|
||||||
|
create_rss_file($posts, 'views/rss/rssnews.php', '/vhosts/vetandlife.ru/rss/news.xml');
|
||||||
|
|
||||||
|
//Турбо
|
||||||
|
create_rss_file($posts, 'views/rss/yaturbo.php', '/vhosts/vetandlife.ru/rss/turbo.xml');
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
ob_start();
|
}
|
||||||
include('views/rss/yanews.php');
|
|
||||||
$result = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
|
|
||||||
$result = trim($result);
|
|
||||||
|
|
||||||
if ($result !== ''){
|
|
||||||
file_put_contents('/vhosts/beta/rss/yanews.xml', trim($result));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function create_rss_dzen(){
|
||||||
|
|
||||||
|
$subcategories = get_categories(array(
|
||||||
|
'child_of' => 14, // pets
|
||||||
|
));
|
||||||
|
|
||||||
|
$subcategories_ids = array($parent_category_id);
|
||||||
|
|
||||||
|
foreach ($subcategories as $subcategory) {
|
||||||
|
$subcategories_ids[] = $subcategory->term_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$args = array(
|
||||||
|
'category__in' => $subcategories_ids,
|
||||||
|
'post_type' => 'post',
|
||||||
|
'post_status' => 'publish',
|
||||||
|
'posts_per_page' => 30,
|
||||||
|
'orderby' => 'date',
|
||||||
|
'order' => 'DESC',
|
||||||
|
);
|
||||||
|
|
||||||
|
$posts = get_posts($args);
|
||||||
|
|
||||||
|
|
||||||
|
create_rss_file($posts, 'views/rss/dzen.php', '/vhosts/vetandlife.ru/rss/dzen.xml');
|
||||||
|
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +85,6 @@ function create_rss_file($posts, $temp, $file){
|
|||||||
|
|
||||||
if( $posts ){
|
if( $posts ){
|
||||||
|
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
include($temp);
|
include($temp);
|
||||||
$result = ob_get_contents();
|
$result = ob_get_contents();
|
||||||
@@ -79,6 +103,51 @@ function create_rss_file($posts, $temp, $file){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getMimeTypeFromExtension($imageUrl) {
|
||||||
|
|
||||||
|
$extension = pathinfo($imageUrl, PATHINFO_EXTENSION);
|
||||||
|
|
||||||
|
switch (strtolower($extension)) {
|
||||||
|
case 'jpg':
|
||||||
|
case 'jpeg':
|
||||||
|
return 'image/jpeg';
|
||||||
|
case 'png':
|
||||||
|
return 'image/png';
|
||||||
|
case 'gif':
|
||||||
|
return 'image/gif';
|
||||||
|
case 'webp':
|
||||||
|
return 'image/webp';
|
||||||
|
default:
|
||||||
|
return false; // Неизвестное расширение
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function filterHtml($html) {
|
||||||
|
|
||||||
|
$html = trim($html);
|
||||||
|
$html = preg_replace('/(\>)\s*(\<)/m', '$1$2', $html);
|
||||||
|
return preg_replace('/<!--(.*?)-->/', '', $html);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function filtercontent($html){
|
||||||
|
|
||||||
|
$content = str_replace('<br /><br />', '</p><p>', $content);
|
||||||
|
$content = str_replace('<br />', '</p><p>', $content);
|
||||||
|
$content = preg_replace('/<\/p>\s*<p>/', '</p><p>', $content);
|
||||||
|
$content = str_replace('<strong>', '<b>', $content);
|
||||||
|
$content = str_replace('</strong>', '</b>', $content);
|
||||||
|
$content = str_replace('<b></b>', '', $content);
|
||||||
|
$content = str_replace('<p></p>', '', $content);
|
||||||
|
$content = strip_tags($content, '<p><a><b><i><u><ul><ol><li><h1><h2><h3><h4><blockquote><iframe><img><figure>');
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -100,12 +100,16 @@ if ( $pets_cat ){
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="promo-agregators" style="text-align: center;">
|
<div class="promo-agregators" style="text-align: center;">
|
||||||
<p>Читайте нас в <span class="promo-telega"><a href="https://t.me/ViZHuvizh" target="_blank">Telegram</a></span></p>
|
<?if ( $pets_cat ):?>
|
||||||
|
<p>Читайте нас в <span class="promo-telega"><a href="https://t.me/pitomcy_vetandlife" target="_blank">Telegram</a></span></p>
|
||||||
|
<?else:?>
|
||||||
|
<p>Читайте нас в <span class="promo-telega"><a href="https://t.me/ViZHuvizh" target="_blank">Telegram</a></span></p>
|
||||||
|
<?endif?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="post_panel_info">
|
<div class="post_panel_info">
|
||||||
<div class="post_panel_info_sub">
|
<div class="post_panel_info_sub">
|
||||||
<span class="post_link_category"><a href="<?=$category_link?>"><?=$category['0']->name;?></a></span>, <nobr><?php the_time('j F Y, G:i');?></nobr>
|
<span class="post_link_category"><a href="<?=$category_link?>"><?=$category_name;?></a></span>, <nobr><?php the_time('j F Y, G:i');?></nobr>
|
||||||
</div>
|
</div>
|
||||||
<div class="post_panel_info_sub">
|
<div class="post_panel_info_sub">
|
||||||
<!--Поделиться <i class="fas fa-share-square btn_soc_post"></i>--> <?php include get_template_directory().'/blocks/social-share.php';?>
|
<!--Поделиться <i class="fas fa-share-square btn_soc_post"></i>--> <?php include get_template_directory().'/blocks/social-share.php';?>
|
||||||
|
|||||||
41
views/rss/dzen.php
Normal file
41
views/rss/dzen.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?echo '<?xml version="1.0" encoding="UTF-8"?>';?>
|
||||||
|
<rss
|
||||||
|
version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/"
|
||||||
|
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss">
|
||||||
|
<channel>
|
||||||
|
<title>Питомцы. Всё о домашних животных</title>
|
||||||
|
<link>https://www.vetandlife.ru</link>
|
||||||
|
<language>ru</language>
|
||||||
|
<?foreach($posts as $post):?>
|
||||||
|
<item>
|
||||||
|
<title><?=htmlspecialchars($post->post_title)?></title>
|
||||||
|
<link><?=get_permalink($post->ID);?></link>
|
||||||
|
<media:rating scheme="urn:simple">nonadult</media:rating>
|
||||||
|
<guid><?=$post->ID?></guid>
|
||||||
|
<category>native-yes</category>
|
||||||
|
<?$content = $post->post_content;
|
||||||
|
$content = str_replace('<br /><br />', '</p><p>', $content);
|
||||||
|
$content = str_replace('<br />', '</p><p>', $content);
|
||||||
|
$content = preg_replace('/<\/p>\s*<p>/', '</p><p>', $content);
|
||||||
|
$content = str_replace('<strong>', '<b>', $content);
|
||||||
|
$content = str_replace('</strong>', '</b>', $content);
|
||||||
|
$content = str_replace('<b></b>', '', $content);
|
||||||
|
$content = str_replace('<p></p>', '', $content);
|
||||||
|
$content = strip_tags($content, '<p><a><b><i><u><ul><ol><li><h1><h2><h3><h4><blockquote><iframe><img><figure>');
|
||||||
|
if (has_post_thumbnail($post->ID)):?>
|
||||||
|
<enclosure url="<?=get_the_post_thumbnail_url($post->ID)?>" type="<?=getMimeTypeFromExtension( get_the_post_thumbnail_url($post->ID) )?>"/>
|
||||||
|
<? $thumbnail_id = get_post_thumbnail_id($post->ID);
|
||||||
|
$image_data = wp_get_attachment_image_src($thumbnail_id, 'full');
|
||||||
|
$image_caption = get_post($thumbnail_id)->post_excerpt;
|
||||||
|
$figure = '<figure><img src="'.get_the_post_thumbnail_url($post->ID).'"><figcaption>'.$image_caption.'</figcaption> </figure>';?>
|
||||||
|
<?else:
|
||||||
|
$figure = '';
|
||||||
|
endif?>
|
||||||
|
<pubDate><?=_U2RFC822($post->post_date)?></pubDate>
|
||||||
|
<content:encoded><![CDATA[<p><?=htmlspecialchars($post->post_excerpt)?></p><?=$figure.$content?>]]>
|
||||||
|
</content:encoded>
|
||||||
|
</item>
|
||||||
|
<?endforeach?>
|
||||||
|
</channel>
|
||||||
|
</rss>
|
||||||
@@ -23,4 +23,4 @@
|
|||||||
</item>
|
</item>
|
||||||
<?endforeach?>
|
<?endforeach?>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
36
views/rss/yaturbo.php
Normal file
36
views/rss/yaturbo.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?echo '<?xml version="1.0" encoding="UTF-8"?>';?>
|
||||||
|
<rss xmlns:yandex="http://news.yandex.ru"
|
||||||
|
xmlns:media="http://search.yahoo.com/mrss/"
|
||||||
|
xmlns:turbo="http://turbo.yandex.ru"
|
||||||
|
version="2.0">
|
||||||
|
<channel>
|
||||||
|
<title>Ветеринария и жизнь</title>
|
||||||
|
<link>https://vetandlife.ru</link>
|
||||||
|
<description>Краткое описание канала</description>
|
||||||
|
<yandex:analytics id="56480275" type="Yandex"></yandex:analytics>
|
||||||
|
<yandex:analytics id="G-VGN4NSFMW5" type="Google"></yandex:analytics>
|
||||||
|
<yandex:adNetwork type="Yandex" id="R-A-4145099"></yandex:adNetwork>
|
||||||
|
<language>ru</language>
|
||||||
|
<?foreach($posts as $post):?>
|
||||||
|
<item turbo="true">
|
||||||
|
<turbo:extendedHtml>true</turbo:extendedHtml>
|
||||||
|
<link><?=get_permalink($post->ID);?></link>
|
||||||
|
<?if (isset($author) and $author !== ''):?>
|
||||||
|
<author><?=$author?></author>
|
||||||
|
<?endif?>
|
||||||
|
<category>События</category>
|
||||||
|
<?if (has_post_thumbnail($post->ID)):?>
|
||||||
|
<enclosure url="<?=get_the_post_thumbnail_url($post->ID)?>" type="<?=getMimeTypeFromExtension( get_the_post_thumbnail_url($post->ID) )?>"/>
|
||||||
|
<? $thumbnail_id = get_post_thumbnail_id($post->ID);
|
||||||
|
$image_data = wp_get_attachment_image_src($thumbnail_id, 'full');
|
||||||
|
$image_caption = get_post($thumbnail_id)->post_excerpt;
|
||||||
|
$figure = '<figure><img src="'.get_the_post_thumbnail_url($post->ID).'"><figcaption>'.$image_caption.'</figcaption> </figure>';?>
|
||||||
|
<?else:
|
||||||
|
$figure = '';
|
||||||
|
endif?>
|
||||||
|
<pubDate><?=_U2RFC822($post->post_date)?></pubDate>
|
||||||
|
<turbo:content><![CDATA[<header><h1><?=htmlspecialchars($post->post_title)?></h1><?=$figure?></header><p><?=htmlspecialchars($post->post_excerpt)?></p><?=filtercontent($post->post_contentt);?><p>Добавляйте ВиЖ в свои источники в <a href="https://dzen.ru/vetandlife?favid=254162793">Дзен</a> и <a href="https://t.me/ViZHuvizh">Телеграм</a></p>]]></turbo:content>
|
||||||
|
</item>
|
||||||
|
<?endforeach?>
|
||||||
|
</channel>
|
||||||
|
</rss>
|
||||||
Reference in New Issue
Block a user